Ambrosia

 view release on metacpan or  search on metacpan

share/Templates/Templates/XSLT+DOJO/edit_json.xsl  view on Meta::CPAN

	</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!=''">

share/Templates/Templates/XSLT+DOJO/edit_json.xsl  view on Meta::CPAN

					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 1.791 second using v1.01-cache-2.11-cpan-2398b32b56e )