mcPUIX.xsl 13.2 KB
<!--
	last update 07.07.2010 @f

	templates/function in this file
	<xsl:template match="XMLArra" />
	<xsl:template match="DBUIElement" />
-->
<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:php="http://php.net/xsl" >

	<xsl:template match="/">
		<xsl:apply-templates select="DBUIElement" mode="dev"/>
		<xsl:apply-templates select="PUIXArray" mode="dev"/>
	</xsl:template>

	<xsl:template match="mcPUIX" mode="dev">
		<xsl:param name="param_inputBE">0</xsl:param>
		<h2><xsl:value-of select="@label" /></h2>
<!--		<b><xsl:value-of select="$param_inputBE" /></b>-->
		<table border="1">
<!--			<tr><td>show</td></tr>-->
			<tr>
				<td>
					<xsl:apply-templates select="DOMmcPUIX_show/PUIXArray" mode="dev">
						<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
					</xsl:apply-templates>
					<br/>					
				</td>
			</tr>
<!--			<tr><td>edit</td></tr>-->
			<tr>
				<td>
					<xsl:apply-templates select="DOMmcPUIX_edit/PUIXArray" mode="dev">
						<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
					</xsl:apply-templates>
					<br/>							
				</td>
			</tr>			
		</table>
	</xsl:template>


	<xsl:template match="PUIXArray" mode="dev">
		<xsl:param name="param_inputBE">0</xsl:param>
		<xsl:param name="param_noform">0</xsl:param>
		
		<xsl:choose>
			
			<xsl:when test="@edit=1 and $param_noform=0">
				<div class="row"><span class="element"><xsl:value-of select="@label" /> count(<xsl:value-of select="@count" />) </span>		</div>
				<xsl:for-each select="DBUIRow">
					<div class="row"><span class="element"><xsl:value-of select="@label" /> i(<xsl:value-of select="@i" />) </span>		</div>
					<xsl:apply-templates select="DBUIElement" mode="dev">
						<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
					</xsl:apply-templates>
				</xsl:for-each>
			</xsl:when>
			<xsl:otherwise>
<!--<xsl:value-of select="count(DBUIRow[@i=mcPUIX::FORM_NEW_ROW])" />/<xsl:value-of select="count(DBUIRow)" />-->
				<xsl:if test="count(DBUIRow[@i='FORM_NEW_ROW'])!=count(DBUIRow)">
					<table border="1">
						<xsl:for-each select="DBUIRow">

								<xsl:choose>
									<xsl:when test="position()=1">
										<tr valign="top">
											<xsl:for-each select="DBUIElement">
												<xsl:if test="@show=1">
													<td><b><xsl:value-of select="@label" /></b></td>
												</xsl:if>
											</xsl:for-each>
										</tr>
									</xsl:when>
								</xsl:choose>

							<xsl:choose>
								<xsl:when test="@i='FORM_NEW_ROW'">

								</xsl:when>
								<xsl:otherwise>
									<tr valign="top">
										<xsl:for-each select="DBUIElement">
											<xsl:choose>
												<xsl:when test="@show=1">
													<td>
			<!--											<xsl:value-of select="position()" />-->
														<xsl:apply-templates select="." mode="dev">
															<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
															<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
														</xsl:apply-templates>
													</td>										
												</xsl:when>
												<xsl:otherwise>
													<xsl:apply-templates select="." mode="dev">
														<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
														<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
													</xsl:apply-templates>										
												</xsl:otherwise>									
											</xsl:choose>
										</xsl:for-each>
									</tr>								
								</xsl:otherwise>									
							</xsl:choose>								
						</xsl:for-each>
					</table>
				</xsl:if>
				
				<table border="1">
					<xsl:for-each select="DBUIRow[@i='FORM_NEW_ROW']">
						<xsl:choose>
							<xsl:when test="position()=1">
								<tr valign="top">
									<xsl:for-each select="DBUIElement">
										<xsl:if test="@show=1">
											<td><b><xsl:value-of select="@label" /></b></td>
										</xsl:if>
									</xsl:for-each>
								</tr>
								<tr valign="top">
									<xsl:for-each select="DBUIElement">
										<xsl:choose>
											<xsl:when test="@show=1">
												<td>
		<!--											<xsl:value-of select="position()" />-->
													<xsl:apply-templates select="." mode="dev">
														<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
														<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
													</xsl:apply-templates>
												</td>										
											</xsl:when>
											<xsl:otherwise>
												<xsl:apply-templates select="." mode="dev">
													<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
													<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
												</xsl:apply-templates>										
											</xsl:otherwise>									
										</xsl:choose>
									</xsl:for-each>
								</tr>									
								
								
							</xsl:when>
						</xsl:choose>						
					</xsl:for-each>
				</table>				
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="DBUIElement" mode="dev">
		<xsl:param name="param_url">?</xsl:param>
		<xsl:param name="param_only_objvar">0</xsl:param>
		<xsl:param name="param_noform">0</xsl:param>
		<xsl:param name="param_withoutLabel">0</xsl:param>
		<xsl:param name="param_inputBE" />

		<xsl:if test="(@objvar=$param_only_objvar or $param_only_objvar=0)">
			
			<span class="{@objvar}Font">
				<div class="row">
					<xsl:if test="$param_withoutLabel=0">
						<span class="label">
							<xsl:if test="@label"><xsl:value-of select="@label" />:</xsl:if>
							<xsl:text disable-output-escaping="no">&#160;</xsl:text>
						</span>
					</xsl:if>
					<span class="element">
						<xsl:choose>
							<xsl:when test="@edit=1 and $param_noform=0">
								<!--<xsl:variable name="var_form_name"><xsl:value-of select="@objvar" /></xsl:variable>-->
								<xsl:if test="@element_classname">
									<input type="hidden" name="{$param_inputBE}[element_classname]" value="{@element_classname}"   />
								</xsl:if>
								
								<xsl:variable name="var_formpath">
									<xsl:choose>
										<xsl:when test="@formpath"><xsl:value-of select="$param_inputBE" /><xsl:value-of select="@formpath" />[FORM_DO_VAR]</xsl:when>											
										<xsl:otherwise><xsl:value-of select="$param_inputBE" />[<xsl:value-of select="@objvar" />]</xsl:otherwise>
									</xsl:choose>											
								</xsl:variable>
								
								<xsl:choose>
									<xsl:when test="@fixed=1">
<!--										<input type="hidden" name="{$param_inputBE}[{@objvar}]" value="{@value}"   />-->
										<input type="hidden" name="{$var_formpath}" value="{@value}"   />
										<xsl:if test="@show=1"><xsl:value-of select="@value"  /></xsl:if>
									</xsl:when>
									<xsl:when test="@type='PUIXArray'">
										es wird nicht formpath übernommen!!!
										<xsl:apply-templates select="PUIXArray" mode="dev">
											<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
										</xsl:apply-templates>
									</xsl:when>									
									<xsl:when test="@type='hidden'">
<!--										<input type="hidden" name="{$param_inputBE}[{@objvar}]" value="{@value}"   />-->
										<input type="hidden" name="{$var_formpath}" value="{@value}"   />
										<xsl:if test="@show=1"><xsl:value-of select="@value"  /></xsl:if>
									</xsl:when>
									<xsl:when test="@type='text'">
<!--										<textarea name="{$param_inputBE}[{@objvar}]" class="width" cols="40" rows="20">-->
										<textarea name="{$var_formpath}" class="width" cols="40" rows="20">
											<xsl:value-of select="."  />
											<xsl:text disable-output-escaping="no">&#160;</xsl:text>
										</textarea>
									</xsl:when>
									<xsl:when test="@type='file'">
										es wird nicht formpath übernommen!!!
										<xsl:call-template name="Function_FileUploadFormular">
											<xsl:with-param name="param_inputBE" select="$param_inputBE" />
										</xsl:call-template>
									</xsl:when>
									<xsl:when test="@type='select'">
<!--										<select name="{$param_inputBE}[{@objvar}]" size="1" class="width">-->
										<select name="{$var_formpath}" size="1" class="width">
											<xsl:for-each select="DBUIList/item">
												<xsl:choose>
													<xsl:when test="@key=../../@value">
														<option value="{@key}" selected="selected"><xsl:value-of select="@value" /></option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{@key}"><xsl:value-of select="@value" /></option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</select>
									</xsl:when>
									<xsl:when test="@type='password'">
										<div class="row">
<!--											<span class="element">1. <input type="password" name="{$param_inputBE}[password2]" class="width" maxlength="{@form_Length}" value="{@value}" /></span>-->
											<span class="element">1. <input type="password" name="{$var_formpath}" class="width" maxlength="{@form_Length}" value="{@value}" /></span>
										</div>
										<div class="row">
<!--											<span class="element">2. <input type="password" name="{$param_inputBE}[password1]" class="width" maxlength="{@form_Length}" value="{@value}" /></span>-->
											<span class="element">2. <input type="password" name="{$var_formpath}" class="width" maxlength="{@form_Length}" value="{@value}" /></span>
										</div>
									</xsl:when>
									<xsl:when test="@type='time'">
										es wird nicht formpath übernommen!!!
										<xsl:call-template name="Function_TimeFormular">
											<xsl:with-param name="param_prefix"><xsl:value-of select="@objvar" />_</xsl:with-param>
											<xsl:with-param name="param_time"><xsl:value-of select="End" /></xsl:with-param>
											<xsl:with-param name="param_inputBE" select="$param_inputBE" />
										</xsl:call-template>
									</xsl:when>
									<xsl:when test="@type='checkbox'">
										<xsl:choose>
											<xsl:when test="@value=1">
<!--												<input type="checkbox" name="{$param_inputBE}[{@objvar}]" value="1" checked="checked" />-->
												<input type="checkbox" name="{$var_formpath}" value="1" checked="checked" />
											</xsl:when>
											<xsl:otherwise>
<!--												<input type="checkbox" name="{$param_inputBE}[{@objvar}]" />-->
												<input type="checkbox" name="{$var_formpath}" />
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>
									<xsl:otherwise>
										<xsl:variable name="var_maxlength"><xsl:value-of select="@maxlength" /></xsl:variable>
										<input class="width" type="text" size="{@size}" maxlength="{@maxlength}" value="{@value}"  name="{$var_formpath}" />
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>
							<xsl:when test="@show=1">
								<xsl:choose>
									<xsl:when test="@objvar='EMail'">
										<!--<xsl:variable name="EMail"><xsl:value-of select="@value" /></xsl:variable>-->
										<span class="LinkFont">
											<a href="mailto:{@value}"><xsl:value-of select="@value" /><xsl:text disable-output-escaping="no">&#160;</xsl:text></a>
										</span>
									</xsl:when>
									<xsl:when test="@type='text'">
										<xsl:value-of select="." disable-output-escaping="yes"/>
									</xsl:when>
									<xsl:when test="@type='FORM_TYPE_SEOLINK'">
										<xsl:apply-templates select="SEOLink" />
									</xsl:when>									
									<xsl:when test="@ID">
										<a href="{$param_url}"><xsl:value-of select="@value" /><xsl:text disable-output-escaping="no">&#160;</xsl:text></a>
									</xsl:when>
									<xsl:when test="@type='PUIXArray'">
										<xsl:apply-templates select="PUIXArray" mode="dev">
											<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
										</xsl:apply-templates>
									</xsl:when>									
									<xsl:when test="@type='time'">
										<xsl:variable name="var_var"><xsl:value-of select="@value" /></xsl:variable>
										<xsl:value-of select="php:function('date', 'j.n.Y H:i', string($var_var) )" />
									</xsl:when>
									<xsl:when test="@type='url'">
										<a href="{@value}"><xsl:value-of select="@value" /></a>
									</xsl:when>
									<xsl:when test="@type='file'">
										<!--<xsl:variable name="var_var"><xsl:value-of select="@value" /></xsl:variable>-->
										<xsl:variable name="var_imgname"><xsl:value-of select="DBUIElement" /></xsl:variable>
										<xsl:variable name="var_varfile"><xsl:value-of select="." /></xsl:variable>

										<xsl:choose>
											<xsl:when test="../DBUIElement[@objvar='Mime'] = 'image'">
												<img src="files/{$var_var}" height="200"  title="{$var_imgname}"/>
											</xsl:when>
											<xsl:otherwise>
												<a href="file.php?p[0]={@value}"> <xsl:value-of select="@value" /></a>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>

									<xsl:otherwise><xsl:value-of select="@value" disable-output-escaping="yes"/></xsl:otherwise>
								</xsl:choose>
							</xsl:when>
						</xsl:choose>
					</span>
				</div>
			</span>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>