Ambrosia
view release on metacpan or search on metacpan
share/Templates/Templates/XSLT+DOJO/edit_json.xsl view on Meta::CPAN
</body>
</html>
</xsl:template>
<xsl:template>
<xslt:attribute name="match"><xslt:value-of select="$UcAppName" /></xslt:attribute>
<xslt:variable name="entityName" select="translate(//atns:Application/atns:Entity/@Name[1], $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
<form method="POST">
<xsl:attribute name="action"><xsl:value-of select="@script" />/<xslt:value-of select="$entityName" /></xsl:attribute>
<!-- input type="hidden" name="m" value=''>
<xslt:attribute name="value">/save/<xslt:value-of select="$entityName" /></xslt:attribute>
</input -->
<xsl:apply-templates select="repository"/>
<!-- xsl:variable name="onClick">onClick:function(){ validate(); }</xsl:variable>
<button data-dojo-type="dijit.form.Button">
<xsl:attribute name="data-dojo-props"><xsl:value-of select="$onClick" /></xsl:attribute>
Validate form!</button -->
<button data-dojo-type="dijit.form.Button" data-dojo-props="type:'submit', value:'Submit'">Submit</button>
</form>
</xsl:template>
<xsl:template match="repository">
<xslt:apply-templates select="atns:Application/atns:Entity" />
</xsl:template>
</xsl:stylesheet>
</xslt:template>
<xslt:template match="atns:Application/atns:Entity">
<xslt:variable name="label">
<xslt:choose>
<xslt:when test="not(@Label) or @Label!=''">
<xslt:value-of select="@Label"/>
</xslt:when>
<xslt:otherwise>
<xslt:value-of select="@Name"/>
</xslt:otherwise>
</xslt:choose>
</xslt:variable>
<xslt:for-each select="atns:Key">
<input type="hidden">
<xslt:attribute name="name"><xslt:value-of select="atns:FieldRef/@Name"/></xslt:attribute>
<xsl:attribute name="value"><xsl:value-of>
<xslt:attribute name="select"><xslt:value-of select="concat('./',../@Name,'/@',atns:FieldRef/@Name)"/></xslt:attribute>
</xsl:value-of>
</xsl:attribute>
</input>
</xslt:for-each>
<table>
<tr><td colspan="2" align="center" style="font-size: 1.2em;">
<b>Edit <xslt:value-of select="$label" /></b>
</td></tr>
<xslt:apply-templates select="atns:Field"/>
<xslt:variable name="EId" select="@Id" />
<xslt:if test="boolean(/atns:Application/atns:EntitysRef/atns:Entity[@Id=/atns:Application/atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef/@RefId and @Type='BIND'])">
<xslt:apply-templates
select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=/atns:Application/atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef/@RefId and @Type='BIND']" mode="bind" />
</xslt:if>
</table>
</xslt:template>
<xslt:template match="atns:Field">
<xslt:variable name="EId" select="../@Id" />
<xslt:variable name="FName" select="@Name" />
<xslt:variable name="label">
<xslt:choose>
<xslt:when test="not(@Label) or @Label!=''">
<xslt:value-of select="@Label"/>
</xslt:when>
<xslt:when test="boolean(/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId and @To=$FName]/../@Type)">
<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId]/../@Type"/>
</xslt:when>
<xslt:otherwise>
<xslt:value-of select="@Name"/>
</xslt:otherwise>
</xslt:choose>
</xslt:variable>
<xslt:if test="not(@Hidden)">
<tr>
<td><xslt:value-of select="$label"/></td>
<td>
<xslt:variable name="name" select="@Name"/>
<xslt:variable name="value" select="concat('./',../@Name,'/@',@Name)"/>
<xslt:variable name="in_type">
<xslt:choose>
<xslt:when test="boolean(@Hidden)">hidden</xslt:when>
<xslt:otherwise>text</xslt:otherwise>
</xslt:choose>
</xslt:variable>
<xslt:choose>
<xslt:when test="@Type='Bool'">
<xsl:variable name="value">,value:1</xsl:variable>
</xslt:when>
<xslt:otherwise>
<xsl:variable name="value">,value:"<xsl:value-of><xslt:attribute name="select"><xslt:value-of select="$value" /></xslt:attribute></xsl:value-of>"</xsl:variable>
</xslt:otherwise>
</xslt:choose>
<xsl:variable name="regExp"><xslt:if test="@Type='Email'">,regExp:<xsl:variable name="s24"><xslt:value-of select="concat('{','2,4}')" /></xsl:variable>"[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]<xsl:value-of select="$s24" />"</xslt:if></xsl:vari...
<xslt:variable name="dojoProps">id:"id_<xslt:value-of select="$name" />",name:"<xslt:value-of select="$name" />",type:"<xslt:value-of select="$in_type" />",trim:true,maxLength:"<xslt:value-of select="@Size" />&qu...
<!--xslt:variable name="dojoProps">
id:"id_<xslt:value-of select="$name" />",
name:"<xslt:value-of select="$name" />",
type:"<xslt:value-of select="$in_type" />",
trim:true,
maxLength:"<xslt:value-of select="@Size" />",
promptMessage:"<xslt:value-of select="@Title" />"</xslt:variable-->
<xslt:variable name="dojoType">
<xslt:choose>
<xslt:when test="@Type='Email'">dijit.form.ValidationTextBox</xslt:when>
<xslt:when test="@Type='String'">dijit.form.ValidationTextBox</xslt:when>
<xslt:when test="@Type='Number'">dijit.form.NumberTextBox</xslt:when>
<xslt:when test="@Type='Double'">dijit.form.NumberTextBox</xslt:when>
<xslt:when test="@Type='Date'">dijit.form.DateTextBox</xslt:when>
<xslt:when test="@Type='Datetime'">dijit.form.DateTextBox</xslt:when>
share/Templates/Templates/XSLT+DOJO/edit_json.xsl view on Meta::CPAN
<xslt:attribute name="test">
<xslt:value-of select="concat('boolean(', $ref, ')')" />
</xslt:attribute><xsl:value-of select="">
<xslt:attribute name="select">
<xslt:value-of select="$ref" />
</xslt:attribute>
</xsl:value-of>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="url"><xsl:value-of select=""><xslt:attribute name="select"><xslt:value-of select="concat('//',$UcAppName,'/@script')" /></xslt:attribute></xsl:value-of>/json</xsl:variable>
<xslt:variable name="entityName" select="translate(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
<xslt:variable name="label">
<xslt:choose>
<xslt:when test="not(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Label) or /atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Label=''">
<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Name"/>
</xslt:when>
<xslt:otherwise>
<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Label"/>
</xslt:otherwise>
</xslt:choose>
</xslt:variable>
<script type="text/javascript">
require(["dijit/form/Select", "dojo/data/ItemFileReadStore", "dojo/store/JsonRest"],
function(Select, ItemFileReadStore, JsonRest){
new JsonRest({target:"<xsl:value-of select="$url" />"})
.get('/<xslt:value-of select="$entityName" />/').then(function(data){
var readStore = new ItemFileReadStore({data: {
identifier: "<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/atns:Key[@AutoUniqueValue='YES']/atns:FieldRef/@Name"/>",
label: "<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/@Name"/>",
<!-- - - >
label: "<xslt:call-template name="join">
<xslt:with-param name="valueList" select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$p_ref_id]/atns:Field[@Hidden!='YES' or not(@Hidden)]/@Name"/>
<xslt:with-param name="separator" select="'_'"/>
</xslt:call-template>",
<! - - -->
items: data.repository.items}
});
var select = new Select({
id: 'id_<xslt:value-of select="@To"/>',
name: "<xslt:value-of select="@To"/>",
value: "<xsl:value-of select="$value_ref"/>",
promptMessage: "Select <xslt:value-of select="$label"/>",
store: readStore
}, "id_<xslt:value-of select="@To"/>");
select.set('style','width: 15em; overflow: hidden;');
select.startup();
});
});
</script>
<input id="id_"><xsl:attribute name="id">id_<xslt:value-of select="@To"/></xsl:attribute></input>
</xslt:template>
<xslt:template match="atns:Entity" mode="bind" >
<xslt:variable name="bindId" select="@Id"/>
<xslt:variable name="EId" select="/atns:Application/atns:Entity/@Id"/>
<xslt:variable name="endId" select="/atns:Application/atns:Relations/atns:Relation[@RefId != $EId]/atns:EntityRef[@RefId = $bindId]/../@RefId"/>
<!--bindId=<xslt:value-of select="$bindId"/>
EId=<xslt:value-of select="$EId"/>
endId=<xslt:value-of select="$endId"/>
name1=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=1]/@Name"/>
name2=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=2]/@Name"/>
name3=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=3]/@Name"/>
name4=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=4]/@Name"/>
name5=<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=5]/@Name"/>
-->
<xsl:variable name="url"><xsl:value-of select=""><xslt:attribute name="select"><xslt:value-of select="concat('//',$UcAppName,'/@script')" /></xslt:attribute></xsl:value-of>/json</xsl:variable>
<xslt:variable name="entityName" select="translate(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$bindId]/@Name, $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
<xslt:variable name="label">
<xslt:choose>
<xslt:when test="not(/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Label) or /atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Label=''">
<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Name"/>
</xslt:when>
<xslt:otherwise>
<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Label"/>
</xslt:otherwise>
</xslt:choose>
</xslt:variable>
<tr><td><xslt:value-of select="$label"/></td>
<td>
<script type="text/javascript">
require(["dijit/form/MultiSelect", "dojo/data/ItemFileReadStore", "dojo/store/JsonRest"],
function(Select, ItemFileReadStore, JsonRest){
new JsonRest({target:"<xsl:value-of select="$url" />"})
.get('/<xslt:value-of select="$entityName" />/').then(function(data){
var readStore = new ItemFileReadStore({data: {
identifier: "<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>",
label: "<xslt:value-of select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=$endId]/@Name"/>",
items: data.repository.items}
});
var select = new Select({
id: 'id_<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>',
name: "<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>",
value: "",
promptMessage: "Select <xslt:value-of select="$label"/>",
store: readStore
}, "id_<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/>");
select.set('style','width: 15em; overflow: hidden;');
select.startup();
});
});
</script>
<input id="id_"><xsl:attribute name="id">id_<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation[@RefId = $endId]/atns:EntityRef[@RefId = $bindId]/@To"/></xsl:attribute></input>
</td></tr>
</xslt:template>
<!-- xslt:template match="atns:Field" mode="relationAttr"><xslt:value-of select="concat($s_q, @Name, $s_q, ':', $s_q, '@', @Name, $s_q)" /><xslt:if test="position()!=last()">,</xslt:if></xslt:template -->
</xslt:stylesheet>
( run in 0.424 second using v1.01-cache-2.11-cpan-2398b32b56e )