<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no" />
<xsl:template match="/">
<cfset viewEvent = viewstate.getValue("myself") & viewstate.getValue("xe.view") />
<cfset editEvent = viewstate.getValue("myself") & viewstate.getValue("xe.edit") />
<cfset deleteEvent = viewstate.getValue("myself") & viewstate.getValue("xe.delete") />
<cfparam name="url.maxrows" default="15" />
<cfparam name="url.startrow" default="1" />
<cfset <xsl:value-of select="object/alias"/>Query = viewstate.getValue("<xsl:value-of select="object/alias"/>Query") />
<cfset variables.prvstart = max(1, url.startrow - url.maxrows) />
<cfset variables.nextstart = min(<xsl:value-of select="object/alias"/>Query.recordcount, url.startrow + url.maxrows) />
<cfset variables.end = min( <xsl:value-of select="object/alias"/>Query.recordcount, (url.startrow + url.maxrows) - 1 ) />
<cfoutput>
<div id="breadcrumb"><xsl:value-of select="object/label"/>s / <a href="#editEvent#">Add New <xsl:value-of select="object/label"/></a></div>
</cfoutput>
<br />
<table class="list">
<thead>
<tr>
<cfset displayedColumns = 1 />
<xsl:for-each select="object/properties/property">
<xsl:if test="primarykey = 'false' and relationship='false' and length < 65535">
<cfset displayedColumns = displayedColumns + 1 />
<th><xsl:value-of select="label"/></th>
</xsl:if>
<!--
<xsl:if test="relationship = 'true' and pluralrelationship = 'false' and length < 65535">
<cfset displayedColumns = displayedColumns + 1 />
<th><xsl:value-of select="label"/></th>
</xsl:if>
-->
</xsl:for-each>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<cfif not <xsl:value-of select="object/alias"/>Query.recordcount>
<tr>
<cfoutput><td colspan="#displayedColumns#"><em>No Records</em></td></cfoutput>
</tr>
<cfelseif <xsl:value-of select="object/alias"/>Query.recordcount gt 1>
<cfoutput>
<cfif url.startrow neq 1>
<a href="#viewstate.getValue("myself")&viewstate.getValue("event")#&startrow=#urlEncodedFormat(variables.prvstart, "UTF-8")#">previous #url.maxrows#</a> /
</cfif>
#url.startrow# - #variables.end# of #<xsl:value-of select="object/alias"/>Query.recordcount#
<cfif variables.nextstart lt <xsl:value-of select="object/alias"/>Query.recordcount>
/ <a href="#viewstate.getValue("myself")&viewstate.getValue("event")#&startrow=#urlEncodedFormat(variables.nextstart, "UTF-8")#">next #url.maxrows#</a>
</cfif>
</cfoutput>
</cfif>
<cfoutput query="<xsl:value-of select="object/alias"/>Query" startrow="#url.startrow#" maxrows="#url.maxrows#">
<cfset keyString = "<xsl:for-each select="object/properties/property"><xsl:if test="primarykey = 'true'">&<xsl:value-of select="alias"/>=#urlEncodedFormat(<xsl:value-of select="/object/alias"/>Query.<xsl:value-of select="alias"/>)#</xsl:if></xsl:for-each>" />
<tr <cfif <xsl:value-of select="object/alias"/>Query.currentRow mod 2 eq 0>class="even"</cfif>>
<xsl:for-each select="object/properties/property">
<xsl:if test="primarykey = 'false' and relationship='false' and length < 65535">
<xsl:if test="cfdatatype = 'date'">
<td><a href="#viewEvent##keystring#">#dateFormat(<xsl:value-of select="alias"/>, "m/d/yyyy")# #timeFormat(<xsl:value-of select="alias"/>, "h:mm TT")#</a></td>
</xsl:if>
<xsl:if test="cfdatatype != 'date'">
<td><a href="#viewEvent##keystring#">#htmlEditFormat(<xsl:value-of select="alias"/>)#</a></td>
</xsl:if>
</xsl:if>
<!--
<xsl:if test="relationship = 'true' and pluralrelationship = 'false' and length < 65535">
<xsl:if test="cfdatatype = 'date'">
<td><a href="#viewEvent##keystring#">#dateFormat(<xsl:value-of select="sourceobject"/>_<xsl:value-of select="sourcecolumn"/>, "m/d/yyyy")# #timeFormat(<xsl:value-of select="sourceobject"/>_<xsl:value-of select="sourcecolumn"/>, "h:mm TT")#</a></td>
</xsl:if>
<xsl:if test="cfdatatype != 'date'">
<td><a href="#viewEvent##keystring#">#htmlEditFormat(<xsl:value-of select="sourceobject"/>_<xsl:value-of select="sourcecolumn"/>)#</a></td>
</xsl:if>
</xsl:if>
-->
</xsl:for-each>
<td>
<a href="#editEvent##keystring#">Edit</a>
<a href="##" onclick="if (confirm('Are you sure you want to delete this <xsl:value-of select="/object/label"/>?')) { document.location.replace('#deleteEvent##keystring#') }; return false">Delete</a>
</td>
</tr>
</cfoutput>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no" />
<xsl:template match="/">
<cfset viewEvent = viewstate.getValue("myself") & viewstate.getValue("xe.view") />
<cfset editEvent = viewstate.getValue("myself") & viewstate.getValue("xe.edit") />
<cfset deleteEvent = viewstate.getValue("myself") & viewstate.getValue("xe.delete") />
<cfparam name="url.maxrows" default="15" />
<cfparam name="url.startrow" default="1" />
<cfset <xsl:value-of select="object/alias"/>Query = viewstate.getValue("<xsl:value-of select="object/alias"/>Query") />
<cfset variables.prvstart = max(1, url.startrow - url.maxrows) />
<cfset variables.nextstart = min(<xsl:value-of select="object/alias"/>Query.recordcount, url.startrow + url.maxrows) />
<cfset variables.end = min( <xsl:value-of select="object/alias"/>Query.recordcount, (url.startrow + url.maxrows) - 1 ) />
<cfoutput>
<div id="breadcrumb"><xsl:value-of select="object/label"/>s / <a href="#editEvent#">Add New <xsl:value-of select="object/label"/></a></div>
</cfoutput>
<br />
<table class="list">
<thead>
<tr>
<cfset displayedColumns = 1 />
<xsl:for-each select="object/properties/property">
<xsl:if test="primarykey = 'false' and relationship='false' and length < 65535">
<cfset displayedColumns = displayedColumns + 1 />
<th><xsl:value-of select="label"/></th>
</xsl:if>
<!--
<xsl:if test="relationship = 'true' and pluralrelationship = 'false' and length < 65535">
<cfset displayedColumns = displayedColumns + 1 />
<th><xsl:value-of select="label"/></th>
</xsl:if>
-->
</xsl:for-each>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<cfif not <xsl:value-of select="object/alias"/>Query.recordcount>
<tr>
<cfoutput><td colspan="#displayedColumns#"><em>No Records</em></td></cfoutput>
</tr>
<cfelseif <xsl:value-of select="object/alias"/>Query.recordcount gt 1>
<cfoutput>
<cfif url.startrow neq 1>
<a href="#viewstate.getValue("myself")&viewstate.getValue("event")#&startrow=#urlEncodedFormat(variables.prvstart, "UTF-8")#">previous #url.maxrows#</a> /
</cfif>
#url.startrow# - #variables.end# of #<xsl:value-of select="object/alias"/>Query.recordcount#
<cfif variables.nextstart lt <xsl:value-of select="object/alias"/>Query.recordcount>
/ <a href="#viewstate.getValue("myself")&viewstate.getValue("event")#&startrow=#urlEncodedFormat(variables.nextstart, "UTF-8")#">next #url.maxrows#</a>
</cfif>
</cfoutput>
</cfif>
<cfoutput query="<xsl:value-of select="object/alias"/>Query" startrow="#url.startrow#" maxrows="#url.maxrows#">
<cfset keyString = "<xsl:for-each select="object/properties/property"><xsl:if test="primarykey = 'true'">&<xsl:value-of select="alias"/>=#urlEncodedFormat(<xsl:value-of select="/object/alias"/>Query.<xsl:value-of select="alias"/>)#</xsl:if></xsl:for-each>" />
<tr <cfif <xsl:value-of select="object/alias"/>Query.currentRow mod 2 eq 0>class="even"</cfif>>
<xsl:for-each select="object/properties/property">
<xsl:if test="primarykey = 'false' and relationship='false' and length < 65535">
<xsl:if test="cfdatatype = 'date'">
<td><a href="#viewEvent##keystring#">#dateFormat(<xsl:value-of select="alias"/>, "m/d/yyyy")# #timeFormat(<xsl:value-of select="alias"/>, "h:mm TT")#</a></td>
</xsl:if>
<xsl:if test="cfdatatype != 'date'">
<td><a href="#viewEvent##keystring#">#htmlEditFormat(<xsl:value-of select="alias"/>)#</a></td>
</xsl:if>
</xsl:if>
<!--
<xsl:if test="relationship = 'true' and pluralrelationship = 'false' and length < 65535">
<xsl:if test="cfdatatype = 'date'">
<td><a href="#viewEvent##keystring#">#dateFormat(<xsl:value-of select="sourceobject"/>_<xsl:value-of select="sourcecolumn"/>, "m/d/yyyy")# #timeFormat(<xsl:value-of select="sourceobject"/>_<xsl:value-of select="sourcecolumn"/>, "h:mm TT")#</a></td>
</xsl:if>
<xsl:if test="cfdatatype != 'date'">
<td><a href="#viewEvent##keystring#">#htmlEditFormat(<xsl:value-of select="sourceobject"/>_<xsl:value-of select="sourcecolumn"/>)#</a></td>
</xsl:if>
</xsl:if>
-->
</xsl:for-each>
<td>
<a href="#editEvent##keystring#">Edit</a>
<a href="##" onclick="if (confirm('Are you sure you want to delete this <xsl:value-of select="/object/label"/>?')) { document.location.replace('#deleteEvent##keystring#') }; return false">Delete</a>
</td>
</tr>
</cfoutput>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>
1 comment:
Dude, make sure you update your URL vars to use viewstate instead!
Post a Comment