Ambrosia

 view release on metacpan or  search on metacpan

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

			"dojo/domReady!", "dojo/parser"]);
		</script>
	</head>
	<body class="claro">
		<xsl:apply-templates select="//repository/mng_EWM" />
		<xsl:apply-templates>
			<xslt:attribute name="select"><xslt:value-of select="$UcAppName" /></xslt:attribute>
		</xsl:apply-templates>
	</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:&quot;<xsl:value-of><xslt:attribute name="select"><xslt:value-of select="$value" /></xslt:attribute></xsl:value-of>&quot;</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>&quot;[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]<xsl:value-of select="$s24" />&quot;</xslt:if></xsl:vari...
			<xslt:variable name="dojoProps">id:&quot;id_<xslt:value-of select="$name" />&quot;,name:&quot;<xslt:value-of select="$name" />&quot;,type:&quot;<xslt:value-of select="$in_type" />&quot;,trim:true,maxLength:&quot;<xslt:value-of select="@Size" />&qu...
<!--xslt:variable name="dojoProps">
id:&quot;id_<xslt:value-of select="$name" />&quot;,
name:&quot;<xslt:value-of select="$name" />&quot;,
type:&quot;<xslt:value-of select="$in_type" />&quot;,
trim:true,
maxLength:&quot;<xslt:value-of select="@Size" />&quot;,
promptMessage:&quot;<xslt:value-of select="@Title" />&quot;</xslt:variable-->



( run in 1.348 second using v1.01-cache-2.11-cpan-364913b4093 )