ParameterFormUtil.xsl 4.87 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="2.0" 
	xmlns:html="http://www.w3.org/TR/REC-html40"
	xmlns:msg="org.pentaho.messages.Messages"
	exclude-result-prefixes="html msg">

    <xsl:include href="system/custom/xsl/html4.xsl"/>
    <xsl:include href="system/custom/xsl/xslUtil.xsl"/>
    
	<xsl:output method="html" encoding="UTF-8" />

	<xsl:template name="doFilters">
	
		<xsl:variable name="editing">
			<xsl:if test="/filters/input[@name='subscribe-title']/@value!=''">
				<xsl:text>true</xsl:text>
			</xsl:if>
		</xsl:variable>
		
		<html>
			<head>
				<link rel='stylesheet' type='text/css' href='/pentaho-portal-layout/pentaho.css' />
				<title><xsl:value-of select="title" disable-output-escaping="yes"/></title>
				<link rel='stylesheet' type='text/css' href='/pentaho-style/active/default.css' />

				<script type="text/javascript" language="javascript" src="/pentaho/js/parameters.js"></script>
				<script type="text/javascript" language="javascript" src="/pentaho/js/subscription.js"></script>

				<script type="text/javascript">
					var pentaho_notOptionalMessage = '<xsl:value-of select="msg:getXslString('UI.USER_PARAMETER_NOT_OPTIONAL')" disable-output-escaping="yes"/>';
					var pentaho_backgroundWarning = '<xsl:value-of select="msg:getXslString('UI.USER_PARAMETER_BACKGROUND_WARNING')" disable-output-escaping="yes"/>';
					var USEPOSTFORFORMS = <xsl:value-of select="$USEPOSTFORFORMS" />;
			        <xsl:for-each select="filter">
						<xsl:if test="@optional = 'true'">
							<xsl:text>pentaho_optionalParams.push('form_</xsl:text><xsl:value-of select="../id"/><xsl:text>.</xsl:text><xsl:value-of select="id"/><xsl:text>');
					</xsl:text>
						</xsl:if>
						<xsl:text>pentaho_paramName["form_</xsl:text><xsl:value-of select="../id"/><xsl:text>.</xsl:text><xsl:value-of select="id"/><xsl:text>"]='</xsl:text>
						<xsl:call-template name="replace-string">
							<xsl:with-param name="text"><xsl:value-of select="title"/></xsl:with-param>
							<xsl:with-param name="from">'</xsl:with-param>
							<xsl:with-param name="to">\'</xsl:with-param>
						</xsl:call-template>
						<xsl:text>';
 					</xsl:text>
					</xsl:for-each>
			    </script>
			    
	    </head>
		<body>
				<div style="margin:10px">
					<span class="portlet-section-header"><xsl:value-of select="title" disable-output-escaping="yes"/></span>
				</div>
				<div style="margin:10px;border:1px solid #808080">

					<br/>
					<table border="0" width="100%" >
						<tr>
							<td>
								<span class="portlet-font"><xsl:value-of select="help" disable-output-escaping="yes"/></span>
							</td>
						</tr>

					<tr>
			
					<td class="portlet-font" colspan="2">
						<div style="display:block"> <!-- run2div -->
							<xsl:attribute name="id">run2div<xsl:value-of select="/filters/id" /></xsl:attribute>

							<xsl:choose>
								<xsl:when test="$editing='true'">
									<xsl:attribute name="style">display:block</xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="style">display:block</xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>

							<form>
								<xsl:if test="$USEPOSTFORFORMS='true'">
									<xsl:attribute name="method">post</xsl:attribute>
									<xsl:attribute name="target">_blank</xsl:attribute>
									<xsl:attribute name="action">/pentaho/ViewAction</xsl:attribute>
								</xsl:if>

								<xsl:attribute name="name">form_<xsl:value-of select="/filters/id" /></xsl:attribute>

								<xsl:call-template name="doSelections" />

								<xsl:for-each select="error">
									<xsl:value-of select="."/>
								</xsl:for-each>

							</form>
                                	</div> <!-- /run2div --> 
					</td>
				</tr>

					<xsl:call-template name="doOptions"/>
					
					</table>					
					<br/>
				</div>
				</body>
		</html>
	</xsl:template>

	<xsl:template name="doFilter">
		<tr>
              <!-- <xsl:element name="br" /> -->
		<td><b><xsl:value-of select="title"/><xsl:text>&#x20;</xsl:text></b></td></tr>
		<tr><td>
		<xsl:for-each select="control">
			<!--  this is important - it copies the definition of the input control into the HTML output -->
	                <xsl:apply-templates/>
		</xsl:for-each>
		</td>
		</tr>
	</xsl:template>

	<xsl:template name="doFilterNoTitle">
		<xsl:for-each select="control">
			<!--  this is important - it copies the definition of the input control into the HTML output -->
	                <xsl:apply-templates/>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="doFilterWithBr">
              <xsl:element name="br" />
		<b><xsl:value-of select="title"/><xsl:text>&#x20;</xsl:text></b>
              <xsl:element name="br" />
		<xsl:for-each select="control">
			<!--  this is important - it copies the definition of the input control into the HTML output -->
	                <xsl:apply-templates/>
		</xsl:for-each>
				
	</xsl:template>


</xsl:stylesheet>