Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • syn-rg 282 posts 425 karma points
    Jun 29, 2011 @ 03:36
    syn-rg
    0

    Change from Related Links to Content Picker property type

    I have a macro that uses a Related Links property. The page linked to is then used to display the Media Type (which is a downloadable file) on the selected page.

    I've had to recreate this macro, but going from V.4.0.3 to V.4.0.0, the Related Links property doesn't work.

    So I've had to change it to the Content Picker property, which is fine, but now all the downloadable files appear in the macro, instead of the file I specified to that page.

    This is the code I was using for the Related Links property:

    <xsl:for-each select="$documentNode/data[@alias = 'assetInformation']/links/link [./@link =  $currentPage/@id ]">

    This is what I'm using for the Content Picker:

    <xsl:for-each select="$documentNode/data[@alias = 'assetInformation'] [$currentPage/@id ]">

    What do I need to change to get it to show only page chosen with the Content Picker?

    Here's my full XSLT:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:memberGroupFunctions="urn:memberGroupFunctions"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
    exclude-result-prefixes="msxml umbraco.library">

    <xsl:include href="DocumentListItem.xslt"/>
    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:variable name="memberAssets" select="string(memberGroupFunctions:GetCurrentMemberAssetsAsString())"/>
    <xsl:template match="/">

    <xsl:value-of select="umbraco.library:RegisterJavaScriptFile('jQueryLightbox', '/scripts/jquery.lightbox-0.5.min.js')"/>
    <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('jQueryLightboxCss', '/css/jQueryLightbox.css')"/>
    <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('document_search', '/css/document_search.css')"/>

    <xsl:variable name="memberid" select="umbraco.library:GetCurrentMember()/@id"/>
    <xsl:variable name="possibleNodes" select="umbraco.library:GetMedia(19722, 'true')/descendant-or-self::node [./data [@alias='versionNumber'] != '']" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div id="download_container_wrap" class="documentItem">
    <h2>Download</h2>
    <div id="download_container">
    <xsl:for-each select="$possibleNodes">
    <xsl:variable name="documentid" select="./@id" />
    <xsl:variable name="documentNode" select="." />

    <!--<xsl:for-each select="$documentNode/data [@alias = 'assetInformation']">
    <xsl:for-each select="$documentNode/data[@alias = 'assetInformation']/links/link [./@link = $currentPage/@id ]">-->
    <xsl:for-each select="$documentNode/data[@alias = 'assetInformation'] [$currentPage/@id ]">

    <xsl:if test="(memberGroupFunctions:CanUserAccessMedia($documentid,$memberid) = 'true')">
    <div><p class="{$documentNode/data [@alias = 'assetExtension']}">
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="$documentNode/data [@alias = 'umbracoFile']"/>
    </xsl:attribute>
    <xsl:attribute name="title">Download file</xsl:attribute>
    <xsl:value-of select="$documentNode/data [@alias = 'assetFileName']"/>
    </a>
    <a href="{concat(substring-before($documentNode/data [@alias = 'Preview'],'.'), '_thumb_300.jpg')}" rel="lightbox" title="File Details" id="aimage{$documentNode/@id}" class="asset_details_button" style="text-decoration:none;">&nbsp;</a>
    </p>
    <div style="display:none; clear:both;" rel="lightbox" id="divaimage{$documentNode/@id}">
    <xsl:call-template name="documentDetailsTemplate">
    <xsl:with-param name="documentNode" select="$documentNode"/>
    <xsl:with-param name="memberAssets" select="$memberAssets"/>
    </xsl:call-template>
    </div></div>
    </xsl:if>
    </xsl:for-each>
    </xsl:for-each>
    <xsl:variable name="hasPDF" select="$possibleNodes[
    (string(./data[@alias = 'versionNumber']) != '' and Exslt.ExsltStrings:uppercase(string(./data[@alias = 'assetExtension'])) = 'PDF')
    and (./data[@alias = 'assetInformation'] )
    ]"/>
    <xsl:variable name="hasZIP" select="$possibleNodes[
    (string(./data[@alias = 'versionNumber']) != '' and Exslt.ExsltStrings:uppercase(string(./data[@alias = 'assetExtension'])) = 'ZIP')
    and (./data[@alias = 'assetInformation'] )
    ]"/>

    <xsl:if test="count($hasPDF)" >
    <div headerindex="0h" class="download_container_menuheader" style="background-position:top;">
    <div class="pdf_help">
    <a href="#">PDF files require Adobe Reader</a>
    </div>
    </div>
    <div contentindex="0c" class="download_container_submenu">
    <a href="http://get.adobe.com/reader/" target="_blank">Click here for installation instructions</a>
    </div>
    </xsl:if>
    <xsl:if test="count($hasZIP)" >
    <div headerindex="1h" class="download_container_menuheader">
    <div class="zip_help">
    <a href="#">Downloads compressed as ZIP files</a>
    </div>
    </div>
    <div contentindex="2c" class="download_container_submenu">
    Once downloaded these files will extract with WinZip (PC), Zip It (Macintosh) or StuffIt Expander.
    </div>
    </xsl:if>
    </div>
    </div></td>
    </tr>
    </table>
    <script type="text/javascript">
    $(document).ready(
    function() {
    $('.documentItem a[rel*=lightbox]').lightBox({
    imageLoading: '/images/image_gallery/loading.gif',
    imageBlank: '/images/image_gallery/blank.gif',
    imageBtnClose: '/images/image_gallery/close.png',
    imageBtnPrev: '/images/image_gallery/prev.gif',
    imageBtnNext: '/images/image_gallery/next.gif'
    });

    });
    </script>
    </xsl:template>
    </xsl:stylesheet>

     

    Cheers,
    JV

     

  • syn-rg 282 posts 425 karma points
    Jul 08, 2011 @ 02:11
    syn-rg
    0

    Solved:

     <xsl:if test="($documentNode/data[@alias = 'assetInformation'] =  $currentPage/@id)">

    Full XSLT:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:memberGroupFunctions="urn:memberGroupFunctions"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
    exclude-result-prefixes="msxml umbraco.library">

    <xsl:include href="DocumentListItem.xslt"/>
    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:variable name="memberAssets" select="string(memberGroupFunctions:GetCurrentMemberAssetsAsString())"/>
    <xsl:template match="/">

    <xsl:value-of select="umbraco.library:RegisterJavaScriptFile('jQueryLightbox', '/scripts/jquery.lightbox-0.5.min.js')"/>
    <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('jQueryLightboxCss', '/css/jQueryLightbox.css')"/>
    <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('document_search', '/css/document_search.css')"/>

    <xsl:variable name="memberid" select="umbraco.library:GetCurrentMember()/@id"/>
    <xsl:variable name="possibleNodes" select="umbraco.library:GetMedia(19831, 'true')/descendant-or-self::node [./data [@alias='versionNumber'] != '']" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div id="download_container_wrap" class="documentItem">
    <h2>Download</h2>
    <div id="download_container">
    <xsl:for-each select="$possibleNodes">
    <xsl:variable name="documentid" select="./@id" />
    <xsl:variable name="documentNode" select="." />
    <xsl:variable name="realtedPageId" select = "$documentNode/data [@alias = 'assetInformation']" />

    <!--<xsl:for-each select="$documentNode/data [@alias = 'assetInformation']">-->
    <xsl:if test="($documentNode/data[@alias = 'assetInformation'] = $currentPage/@id)">
    <!--<xsl:for-each select="$documentNode/data[@alias = 'assetInformation']= $currentPage/@id]">-->

    <xsl:if test="(memberGroupFunctions:CanUserAccessMedia($documentid,$memberid) = 'true')">
    <div><p class="{$documentNode/data [@alias = 'assetExtension']}">
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="$documentNode/data [@alias = 'umbracoFile']"/>
    </xsl:attribute>
    <xsl:attribute name="title">Download file</xsl:attribute>
    <xsl:value-of select="$documentNode/data [@alias = 'assetFileName']"/>
    </a>
    <a href="{concat(substring-before($documentNode/data [@alias = 'Preview'],'.'), '_thumb_300.jpg')}" rel="lightbox" title="File Details" id="aimage{$documentNode/@id}" class="asset_details_button" style="text-decoration:none;">&nbsp;</a>
    </p>
    <div style="display:none; clear:both;" rel="lightbox" id="divaimage{$documentNode/@id}">
    <xsl:call-template name="documentDetailsTemplate">
    <xsl:with-param name="documentNode" select="$documentNode"/>
    <xsl:with-param name="memberAssets" select="$memberAssets"/>
    </xsl:call-template>
    </div></div>
    </xsl:if>
    </xsl:if>
    </xsl:for-each>
    <xsl:variable name="hasPDF" select="$possibleNodes[
    (string(./data[@alias = 'versionNumber']) != '' and Exslt.ExsltStrings:uppercase(string(./data[@alias = 'assetExtension'])) = 'PDF')
    and (./data[@alias = 'assetInformation'] )
    ]"/>
    <xsl:variable name="hasZIP" select="$possibleNodes[
    (string(./data[@alias = 'versionNumber']) != '' and Exslt.ExsltStrings:uppercase(string(./data[@alias = 'assetExtension'])) = 'ZIP')
    and (./data[@alias = 'assetInformation'] )
    ]"/>

    <xsl:if test="count($hasPDF)" >
    <div headerindex="0h" class="download_container_menuheader" style="background-position:top;">
    <div class="pdf_help">
    <a href="#">PDF files require Adobe Reader</a>
    </div>
    </div>
    <div contentindex="0c" class="download_container_submenu">
    <a href="http://get.adobe.com/reader/" target="_blank">Click here for installation instructions</a>
    </div>
    </xsl:if>
    <xsl:if test="count($hasZIP)" >
    <div headerindex="1h" class="download_container_menuheader">
    <div class="zip_help">
    <a href="#">Downloads compressed as ZIP files</a>
    </div>
    </div>
    <div contentindex="2c" class="download_container_submenu">
    Once downloaded these files will extract with WinZip (PC), Zip It (Macintosh) or StuffIt Expander.
    </div>
    </xsl:if>
    </div>
    </div></td>
    </tr>
    </table>
    <script type="text/javascript">
    $(document).ready(
    function() {
    $('.documentItem a[rel*=lightbox]').lightBox({
    imageLoading: '/images/image_gallery/loading.gif',
    imageBlank: '/images/image_gallery/blank.gif',
    imageBtnClose: '/images/image_gallery/close.png',
    imageBtnPrev: '/images/image_gallery/prev.gif',
    imageBtnNext: '/images/image_gallery/next.gif'
    });

    });
    </script>
    </xsl:template>
    </xsl:stylesheet>
Please Sign in or register to post replies

Write your reply to:

Draft