Wednesday, February 22, 2012

SharePoint lytebox with link to dispform.aspx

Building on the work of the codeplex project:
http://lyteboxsp.codeplex.com/

Note to change the Title/link of the webpart, modify the parameters binding either on the web or in designer. The binding must match the name of the library, not the url.

I updated the code slightly in the dataview to include a link to the dispform.aspx for the picture. It seems the key is to write the link with escaped characters.  I also update the javascript to ver 5.5

Also, you can update preferences for lytebox in the section "data-lyte-options"

---Copy and Replace below in the Dataview----
<a> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="starts-with(@FileRef, '/')"> <xsl:value-of select="@FileRef"> </xsl:value-of></xsl:when> <xsl:otherwise> <xsl:value-of select="concat(&quot;/&quot;,@FileRef)"> </xsl:value-of></xsl:otherwise> </xsl:choose> </xsl:attribute>
<xsl:attribute name="class">lytebox</xsl:attribute> <xsl:attribute name="data-lyte-options">autoResize:true slide:true group:name slideInterval:6000 showNavigation:true</xsl:attribute> <xsl:attribute name="data-title">Title:<xsl:value-of select="@Title"></xsl:value-of></xsl:attribute><xsl:attribute name="data-description"> Description: <xsl:value-of select="@Description"> ; Link: &lt;a href="/<xsl:value-of select="@FileDirRef">/Forms/DispForm.aspx?ID=<xsl:value-of select="@ID">" target="_parent"&gt; See more details &lt;/a&gt;  </xsl:value-of></xsl:value-of></xsl:value-of></xsl:attribute> <img style="border: 3px solid white; margin: 5px;" src="" />    <xsl:attribute name="src">        <xsl:value-of select="concat(&quot;/&quot;,@FileDirRef,&quot;/_t/&quot;,translate(@FileLeafRef, &quot;.&quot;, &quot;_&quot;),&quot;.&quot;,@FileType)">    </xsl:value-of></xsl:attribute>
</a>

No comments:

Post a Comment