Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListHow can I make Search work with the CardView?How can I make Search work with the CardView?
Previous
 
Next
New Post
5/9/2008 8:04 PM
 

Here's a sample XSLT File to get the Search, Card View & Detail View to Work.

 
New Post
5/9/2008 10:15 PM
 

Here's a sample XSLT File to get the Search, Card View & Detail View to Work. Just copy and paste the code into wordpad and save it as an .xsl file. Then upload to the /desktopmodules/userdefinedtable/xslstylesheets folder of your website. Last thing you need to do is change the userdefinedtable to the xsl file you just uploaded. Go to manage userdefinedtable's display settings and choose the predefined xsl file.

<?xml version="1.0" encoding="UTF-8" ?>
<!--
 DotNetNuke® - http://www.dotnetnuke.com
 Copyright (c) 2002-2007 by DotNetNuke Corp.

 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 to permit persons to whom the Software is furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in all copies or substantial portions
 of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS IN THE SOFTWARE.
-->
<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" />
  <!--
  This prefix is used to generate module specific query strings
  Each querystring or form value that starts with udt_{ModuleId}_param
  will be added as parameter starting with param
  -->
  <xsl:variable name="prefix_param">udt_<xsl:value-of select="//udt:Context/udt:ModuleId" />_param</xsl:variable>
  <xsl:param name="param_search" />
  <xsl:param name="param_searchpostback" />
  <xsl:param name="param_ispostback" />
  <xsl:variable name="search">
    <xsl:choose>
      <xsl:when test="$param_ispostback">
        <xsl:value-of select="$param_searchpostback" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$param_search" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:param name="param_page" select="1" />
  <xsl:variable name="paging" select="//udt:Context/udt:Paging" />
  <xsl:variable name="orderBy" select="//udt:Fields[udt:UserDefinedFieldId=//udt:Context/udt:OrderBy]/udt:SortColumn" />
  <xsl:variable name="orderDirection" select="//udt:Context/udt:OrderDirection" />
  <xsl:variable name="orderType">
    <xsl:variable name="dataType" select="//udt:Fields[udt:UserDefinedFieldId=//udt:Context/udt:OrderBy]/udt:FieldType" />
    <xsl:choose>
      <xsl:when test="$dataType='Int32' or $dataType='Decimal' or $dataType='Currency'">number</xsl:when>
      <xsl:otherwise>text</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:param name="param_detail" />
 
  <xsl:template match="udt:Data" mode="detail">
    <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 ="currencyColumn" select="//udt:Fields[udt:FieldType='Currency'][1]/udt:ValueColumn"/>
    <xsl:variable name="id" select="udt:UserDefinedRowId"/>
    <table cellspacing="0" cellpadding="4" border="0" style="border: silver 1px solid; border-collapse: collapse;">
      <tr>
        <td>    
          <div align="center"><font style="font-size:18px"><strong><xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$titleColumn]" disable-output-escaping="yes"/></strong></font></div>
        </td>
      </tr>
      <tr>
        <td>
          <table cellspacing="0" cellpadding="7"  border="0" style="border-width:0px;border-collapse:collapse;">
            <tr class="normal">
              <td valign="middle">
                <xsl:call-template name="EditLink" />
              </td>
              <td valign="middle">
    <xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$imgColumn]" disable-output-escaping="yes"/>
     </td>
              <td>
                <table cellspacing="7" 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 (udt:Visible='true' or udt:Visible='True')" >
       <tr class="normal">
        <xsl:if test="(position() mod 2 = 1)">
         <xsl:attribute name="bgcolor">#FFFFFF</xsl:attribute>
        </xsl:if>
        <td class="subhead" align="left" >
         <xsl:value-of select ="udt:FieldTitle"/>:
        </td>
        <td>&#160;</td>
        <td class="normal" align="left" >
         <xsl:choose>
            <xsl:when test="udt:FieldType='Currency'">
               <xsl:value-of select='format-number($CurrentValue, "$###,##0.00")' disable-output-escaping="yes"/>
            </xsl:when>
            <xsl:when test="udt:FieldType='Int32' and udt:FieldTitle!='Year'">
               <xsl:value-of select='format-number($CurrentValue, "###,##0")' disable-output-escaping="yes"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="$CurrentValue" disable-output-escaping="yes"/>
            </xsl:otherwise>
         </xsl:choose>           
        </td>
       </tr>
      </xsl:if>
     </xsl:for-each>
    </table>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
   <p><xsl:call-template name="ListView" /><a href="{//udt:Context/udt:ApplicationPath}/tabid/{//udt:Context/udt:TabId}/Default.aspx"><font color="#0000FF">Go back</font></a></p>
  </xsl:template>
 
  <xsl:template match="udt:Data" mode="list">
    <xsl:param name="from" select="1" />
    <xsl:param name="to" select="count(*)" />
    <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="id" select="udt:UserDefinedRowId"/>
    <xsl:if test="position() &gt; $from and position() &lt; $to">
    <table cellspacing="0" cellpadding="4" border="0" style="border: silver 1px solid; border-collapse: collapse;">
      <tr>
        <td>
          <xsl:call-template name="EditLink" />
        </td>
        <td>
          <xsl:call-template name="DetailView" />
        </td>
        <td valign="middle">
    <xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$imgColumn]" disable-output-escaping="yes"/>
     </td>
        <td>
          <table cellspacing="0" cellpadding="4" border="0" style="border-width:0px;border-collapse:collapse;">
            <tr>
              <td>
                <strong><xsl:value-of select="udt:Full_x0020_Name" disable-output-escaping="yes" /></strong>
              </td>
            </tr>
            <tr>
              <td>
                <xsl:value-of select="udt:City" disable-output-escaping="yes" />, <xsl:value-of select="udt:State" disable-output-escaping="yes" />
              </td>
            </tr>
            <tr>
              <td>
                <xsl:value-of select="udt:Country" disable-output-escaping="yes" />
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <br />
    </xsl:if>
  </xsl:template>
 
  <xsl:template match="/udt:UserDefinedTable">
    <div align="center">
    <span class="style1"><font style="font-size:18px"><strong>Graphicsphere.Net® 3D Modelers</strong></font></span><br />
    <span class="style2"><font style="font-size:12px">Search for a 3D modeler in your city, state or country.</font></span>
    <br /><br />
    <xsl:choose>
      <xsl:when test="$param_detail">
        <!--master-detail view-->
        <xsl:apply-templates select="udt:Data[udt:UserDefinedRowId=$param_detail]" mode="detail" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="searchColumns" select="//udt:Fields[udt:Searchable='true']/udt:ValueColumn" />
        <xsl:if test="//udt:Fields[udt:Searchable='true']">
          <xsl:call-template name="Searchform" />
        </xsl:if>
        <br /><br />
        <xsl:variable name="currentData" select="udt:Data[contains(*[name()=$searchColumns][1],$search) or contains(*[name()=$searchColumns][2],$search) or contains(*[name()=$searchColumns][3],$search) or contains(*[name()=$searchColumns][4],$search) or contains(*[name()=$searchColumns][5],$search)]" />
        <xsl:variable name="from">
          <xsl:choose>
            <xsl:when test="$paging">
              <xsl:value-of select="$paging * $param_page - $paging" />
            </xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="to">
          <xsl:choose>
            <xsl:when test="$paging">
              <xsl:value-of select="$paging * $param_page +1" />
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="count($currentData)+1" />
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <table>
          <xsl:apply-templates select="$currentData" mode="list">
            <xsl:sort select="*[name()=$orderBy]" order="{$orderDirection}" data-type="{$orderType}" />
            <xsl:with-param name="from" select="$from" />
            <xsl:with-param name="to" select="$to" />
          </xsl:apply-templates>
        </table>
        <xsl:if test="$paging">
          <xsl:call-template name="renderPaging">
            <xsl:with-param name="maxPages" select="ceiling(count($currentData) div $paging)" />
          </xsl:call-template>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
    </div>
  </xsl:template>

  <xsl:template name="Searchform">
    <input type="text" name="{$prefix_param}_searchPostback" value="{$search}" />
    <input type="submit" name="go" value="{//udt:Context/udt:LocalizedString_Search}" />
    <input type="hidden" name="{$prefix_param}_ispostback" value="true" />
  </xsl:template>

  <xsl:template name="pagingSinglePages">
    <!--renders paging links-->
    <xsl:param name="pageNumber" select="1" />
    <xsl:param name="maxPages" select="ceiling(count(//udt:Data) div $paging)" />
    <xsl:choose>
      <xsl:when test="$param_page=$pageNumber">
        <span class="NormalDisabled">[<xsl:value-of select="$pageNumber" />]</span>
      </xsl:when>
      <xsl:otherwise>
        <a href="" class="CommandButton">
          <xsl:value-of select="$pageNumber" />
        </a>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:if test="$pageNumber &lt; $maxPages">
      <xsl:call-template name="pagingSinglePages"><xsl:with-param name="pageNumber" select="$pageNumber +1" /><xsl:with-param name="maxPages" select="$maxPages" />
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name="renderPaging">
    <xsl:param name="maxPages" select="ceiling(count(//udt:Data) div $paging)" />
    <xsl:variable name="previous" select="$param_page - 1" />
    <xsl:variable name="next" select="$param_page + 1" />
    <table class="PagingTable" bordercolor="silver" border="0" style="border-color:silver;border-width:1px;border-style:Solid;width:100%;">
      <tr>
        <td class="Normal" align="Left">
          <xsl:value-of select="//udt:Context/udt:LocalizedString_Page" />&#160;<xsl:value-of select="$param_page" />&#160;<xsl:value-of select="//udt:Context/udt:LocalizedString_Of" />&#160;<xsl:value-of select="$maxPages" /></td>
        <td class="Normal" align="Right">
          <xsl:choose>
            <xsl:when test="$param_page&gt;1">
              <a href="" class="CommandButton">
                <xsl:value-of select="//udt:Context/udt:LocalizedString_First" />
              </a>
            </xsl:when>
            <xsl:otherwise>
              <span class="NormalDisabled">
                <xsl:value-of select="//udt:Context/udt:LocalizedString_First" />
              </span>
            </xsl:otherwise>
          </xsl:choose> 
<xsl:choose><xsl:when test="$param_page&gt;1"><a href="" class="CommandButton"><xsl:value-of select="//udt:Context/udt:LocalizedString_Previous" /></a></xsl:when><xsl:otherwise><span class="NormalDisabled"><xsl:value-of select="//udt:Context/udt:LocalizedString_Previous" /></span></xsl:otherwise></xsl:choose> 
<xsl:variable name="startpage"><xsl:choose><xsl:when test="$param_page&gt;5"><xsl:value-of select="$param_page -4" /></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="endpage"><xsl:choose><xsl:when test="$startpage+9&gt;$maxPages"><xsl:value-of select="$maxPages" /></xsl:when><xsl:otherwise><xsl:value-of select="$startpage +9" /></xsl:otherwise></xsl:choose></xsl:variable><xsl:call-template name="pagingSinglePages"><xsl:with-param name="pageNumber" select="$startpage" /><xsl:with-param name="maxPages" select="$endpage" /></xsl:call-template><xsl:choose><xsl:when test="$param_page&lt;$maxPages"><a href="" class="CommandButton"><xsl:value-of select="//udt:Context/udt:LocalizedString_Next" /></a></xsl:when><xsl:otherwise><span class="NormalDisabled"><xsl:value-of select="//udt:Context/udt:LocalizedString_Next" /></span></xsl:otherwise></xsl:choose> 
<xsl:choose><xsl:when test="$param_page&lt;$maxPages"><a href="" class="CommandButton"><xsl:value-of select="//udt:Context/udt:LocalizedString_Last" /></a></xsl:when><xsl:otherwise><span class="NormalDisabled"><xsl:value-of select="//udt:Context/udt:LocalizedString_Last" /></span></xsl:otherwise></xsl:choose> 
</td>
      </tr>
    </table><br />
   <div align="center"><strong>Total Modelers: <xsl:value-of select="count(udt:Data)"/></strong></div>
  </xsl:template>

  <xsl:template name="EditLink">
    <xsl:if test="udt:EditLink">
      <a href="{udt:EditLink}">
        <img border="0" alt="edit" src="{//udt:Context/udt:ApplicationPath}/images/edit.gif" />
      </a>
    </xsl:if>
  </xsl:template>

  <xsl:template name="ListView">
    <a href="{//udt:Context/udt:ApplicationPath}/tabid/{//udt:Context/udt:TabId}/Default.aspx">
      <img border="0" alt="Back" src="{//udt:Context/udt:ApplicationPath}/images/lt.gif" />
    </a>
  </xsl:template>

  <xsl:template name="DetailView">
    <a href="?{$prefix_param}_detail={udt:UserDefinedRowId}">
      <img border="0" alt="detail" src="{//udt:Context/udt:ApplicationPath}/images/view.gif" />
    </a>
  </xsl:template>
</xsl:stylesheet>

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListHow can I make Search work with the CardView?How can I make Search work with the CardView?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out