I'm fairly new to the DNN world and have started a reunion site for my 20th year this summer. Inside it, I created a directory with the following fields:
Field Name - Field Type
Current Picture - Image
Name (1988) - Text
Name (2008) - Text
Bio - Rich Text
Milltary - True/False
External Personal Site - URL
Here's the style sheet I'm using to display the list.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:udt="DotNetNuke/UserDefinedTable">
<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name ="imgColumn" select="//udt:Fields[udt:FieldType='Image'][1]/udt:ValueColumn"/>
<xsl:variable name ="titleColumn" select="//udt:Fields[udt:FieldType='String'][1]/udt:ValueColumn"/>
<xsl:variable name ="htmlColumn" select="//udt:Fields[udt:FieldType='TextHtml'][1]/udt:ValueColumn"/>
<table cellspacing="0" cellpadding="4" border="0" style="border-width:0px;border-collapse:collapse;">
<xsl:for-each select="udt:Data">
<xsl:variable name="id" select="udt:UserDefinedRowId"/>
<tr class="normal">
<td valign="top" style="border-bottom: silver 1px solid;">
<xsl:if test="udt:EditLink">
<a>
<xsl:attribute name="href">
<xsl:value-of select="udt:EditLink" />
</xsl:attribute>
<img border="0" alt="edit">
<xsl:attribute name="src">
<xsl:value-of select="//udt:Context/udt:ApplicationPath"/>/images/edit.gif</xsl:attribute>
</img>
</a>
</xsl:if>
</td>
<td valign="top" style="border-bottom: silver 1px solid;;"><a href="" target="_blank" >
<xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$imgColumn]" disable-output-escaping="yes"/></a>
</td>
<td style="border-bottom: silver 1px solid;">
<h2><xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$titleColumn]" disable-output-escaping="yes"/></h2>
<xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$htmlColumn]" disable-output-escaping="yes"/>
<table cellspacing="0" cellpadding="0" border="0">
<xsl:for-each select="//udt:Fields">
<xsl:variable name="NameOfValueColumn" select="udt:ValueColumn"/>
<xsl:variable name="CurrentValue" select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]"/>
<xsl:if test ="$CurrentValue and $CurrentValue!='' and ($NameOfValueColumn!=$imgColumn or not($imgColumn)) and ($NameOfValueColumn!=$titleColumn or not($titleColumn)) and ($NameOfValueColumn!=$htmlColumn or not($htmlColumn))and (udt:Visible='true' or udt:Visible='True')" >
<tr class="normal">
<td>
<xsl:value-of select ="udt:FieldTitle"/>:
</td>
<td> </td>
<td>
<xsl:value-of select="$CurrentValue" disable-output-escaping="yes"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
This is probably pretty standard. However, I have the following problems with the view:
1) I want to sort the list by the "Name (1988)" field in alphabetical ascending order
2) I want the "Current Picture" field to have a link on it to view the full picture in a pop-up window. It currently shows a 100px thumbnail next to the record. The thumbnail should be clicked to see the full image.
XSL is pretty foreign to me at the moment and any help would be appreciated. Thanks in advance.
As a side curiosity, how does the list pull data? I can't find a stored proc in the db or view to pull from. What SQL statement could I use to generate my own dataset from the "Directory" custom udt module?