Ambrosia

 view release on metacpan or  search on metacpan

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

<?xml version="1.0" encoding="UTF-8" ?>
<xslt:stylesheet version="1.0" 
	xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
	xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias"
	xmlns:atns="app://Ambrosia/EntityDataModel/2011/V1">

<xslt:import href="incDojo_JS_Css.xsl" />

<xslt:output method="xml" indent="yes" />
<xslt:namespace-alias stylesheet-prefix="xsl" result-prefix="xslt"/>

<xslt:include href="../../incName.xsl" />
<xslt:include href="../../incUtils.xsl" />

<xslt:template match="/">

<xsl:stylesheet version="1.0">
<xsl:output method="html" indent="yes" />
<xsl:include href="_message.xsl"/>

<xsl:template match="/"><xsl:text disable-output-escaping="yes">&lt;!DOCTYPE HTML>
</xsl:text>
<html lang="en">
	<xslt:if test="boolean(/Application/@Language)">
		<xslt:attribute name="lang">
			<xslt:value-of select="/Application/@Language"/>
		</xslt:attribute>
	</xslt:if>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<xslt:apply-imports/>

		<script type="text/javascript">
			require([
			"dijit/dijit",
			"dijit/form/Form",
			"dijit/form/Button",
			"dijit/form/ValidationTextBox",
<xslt:for-each select="//atns:Application/atns:Entity/atns:Field[not(@Type=preceding-sibling::atns:Field/@Type)]">
	<xslt:choose>
		<xslt:when test="@Type='String' and not(@Hidden)">
			"dijit/form/TextBox",</xslt:when>

		<xslt:when test="@Type='Number'">
			"dijit/form/NumberTextBox",</xslt:when>

		<xslt:when test="@Type='Double' and not(@Hidden)">
		</xslt:when>

		<xslt:when test="@Type='Bool' and not(@Hidden)">
			"dijit/form/CheckBox",</xslt:when>

		<xslt:when test="@Type='Date' or @Type='Datetime'">
			"dojo/date", "dojo/date/locale",
			"dijit/form/DateTextBox",</xslt:when>

		<xslt:when test="@type='Text'">
			"dijit/form/Textarea",
			"dijit/form/SimpleTextarea",
			"dijit/Editor",</xslt:when>
	</xslt:choose>
</xslt:for-each>
			"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>



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