sharepointrssmosstwitterlaconica

How can I integrate Laconica update stream into SharePoint?


I have Laconica (self hosted twitter) configured on my local intranet and would like to integrate the public stream into SharePoint site with a web part. How can I do this?


Solution

  • You can point an RSS Viewer web part at the laconi.ca public stream RSS feed and use this XSLT to ensure attractive output.

    Result screen shot:

    Screenshot of Laconica update stream in SharePoint Team Site

    XSL transform:

    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt"
                   xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
                   xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                   xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                   xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
                   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                   xmlns:dc="http://purl.org/dc/elements/1.1/"
                   xmlns:rss="http://purl.org/rss/1.0/"
                   xmlns:atom="http://www.w3.org/2005/Atom"
                   xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
                   xmlns:atom2="http://purl.org/atom/ns#"
                   xmlns:ddwrt2="urn:frontpage:internal"
                   xmlns:laconica="http://laconi.ca/ont/">
      <xsl:param name="rss_FeedLimit">5</xsl:param>
      <xsl:param name="rss_ExpandFeed">false</xsl:param>
      <xsl:param name="rss_LCID">1033</xsl:param>
      <xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
      <xsl:param name="rss_alignValue">left</xsl:param>
      <xsl:param name="rss_IsDesignMode">True</xsl:param>
      <xsl:template match="rdf:RDF">
        <xsl:call-template name="RDFMainTemplate"/>
      </xsl:template>
      <xsl:template name="RDFMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
        <xsl:variable name="Rows" select="rss:item"/>
        <xsl:variable name="RowCount" select="count($Rows)"/>
        <div class="slm-layout-main" >
          <xsl:call-template name="RDFMainTemplate.body">
            <xsl:with-param name="Rows" select="$Rows"/>
            <xsl:with-param name="RowCount" select="count($Rows)"/>
          </xsl:call-template>
        </div>
      </xsl:template>
      <xsl:template name="RDFMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
        <xsl:param name="Rows"/>
        <xsl:param name="RowCount"/>
        <xsl:for-each select="$Rows">
          <xsl:variable name="CurPosition" select="position()" />
          <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
          <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
          <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
            <xsl:element name="div">
              <xsl:if test="($CurPosition mod 2 = 1)">
                <xsl:attribute name="style"><![CDATA[background-color:#F9F9F9;]]></xsl:attribute>
              </xsl:if>
              <xsl:element name="table">
                <xsl:attribute name="cellpadding">0</xsl:attribute>
                <xsl:attribute name="border">0</xsl:attribute>
                <xsl:attribute name="style"><![CDATA[margin:0px;padding:0px;border-spacing:0px;background-color:transparent;]]></xsl:attribute>
                <xsl:element name="tr">
                  <xsl:element name="td">
                    <xsl:attribute name="style"><![CDATA[vertical-align:top;padding:0px;background-color:transparent;]]></xsl:attribute>
                    <xsl:attribute name="rowspan">2</xsl:attribute>
                    <xsl:element name="img">
                      <xsl:attribute name="src"><xsl:value-of select="laconica:postIcon/@rdf:resource"/></xsl:attribute>
                      <xsl:attribute name="style"><![CDATA[margin:3px;height:48px;width:48px;]]></xsl:attribute>
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="td">
                    <xsl:attribute name="style"><![CDATA[vertical-align:top;padding:0px;background-color:transparent;]]></xsl:attribute>
                    <div>
                      <strong><xsl:value-of select="substring-before(rss:title, ':')"/></strong>
                    </div>
                    <div style="width:300px;overflow-x:hidden;">
                      <div>
                        <xsl:value-of select="substring-after(rss:title, ':')"/>
                      </div>
                    </div>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="tr">
                  <xsl:element name="td">
                    <xsl:attribute name="style"><![CDATA[padding:0px;background-color:transparent;]]></xsl:attribute>
                    <xsl:element name="a">
                      <xsl:attribute name="href"><xsl:value-of select="rss:link"/></xsl:attribute>
                      <xsl:value-of select="ddwrt:FormatDate(dc:date,number($rss_LCID),15)"/>
                    </xsl:element>
                  </xsl:element>
                </xsl:element>
              </xsl:element>
            </xsl:element>
          </xsl:if>
        </xsl:for-each>
      </xsl:template>
    </xsl:stylesheet>