带有jq的视频在sharepoint 2013中的DataView WebPart中不起作用

时间:2013-10-10 06:35:51

标签: jquery sharepoint dataviewwebpart

我在sharepoint 2013中有一个dataview webpart。视频网址来自列表,视频上传到文档中。第一个视频工作正常,但其他视频无效。 这是样式表模板

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
                        <xsl:param name="dvt_apos">'</xsl:param>
                        <xsl:param name="ManualRefresh"></xsl:param>
                        <xsl:param name="dvt_firstrow">1</xsl:param>
                        <xsl:param name="dvt_nextpagedata" />
                        <xsl:variable name="dvt_1_automode">0</xsl:variable>
                        <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
                            <xsl:choose>
                                <xsl:when test="($ManualRefresh = 'True')">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td valign="top">
                        <xsl:call-template name="dvt_1"/>
                    </td>
                    <td width="1%" class="ms-vb" valign="top">
                        <img src="/_layouts/15/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/>
                    </td>
                </tr>
            </table>
        </xsl:when>
                                <xsl:otherwise>
                                    <xsl:call-template name="dvt_1"/>
        </xsl:otherwise>
                            </xsl:choose>
</xsl:template>

                        <xsl:template name="dvt_1">
                            <xsl:variable name="dvt_StyleName">Table</xsl:variable>
                            <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
                            <xsl:variable name="dvt_RowCount" select="count($Rows)"/>
                            <xsl:variable name="RowLimit" select="10" />
                            <xsl:variable name="FirstRow" select="$dvt_firstrow" />
                            <xsl:variable name="LastRow" select="$FirstRow + $dvt_RowCount - 1" />
                            <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
                            <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/>

                            <xsl:choose>
                                <xsl:when test="$dvt_IsEmpty">
                                    <xsl:call-template name="dvt_1.empty"/>
        </xsl:when>
                                <xsl:otherwise>
            <table border="0" width="100%" cellpadding="2" cellspacing="0">
                <tr valign="top">
                    <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
                        <th class="ms-vh" width="1%" nowrap="nowrap"></th>
                    </xsl:if>
                    <th class="ms-vh" nowrap="nowrap">Video</th>
                </tr><tr><td><div id="mediaplayer">
                    <xsl:call-template name="dvt_1.body">
                        <xsl:with-param name="Rows" select="$Rows"/>
                        <xsl:with-param name="FirstRow" select="1" />
                        <xsl:with-param name="LastRow" select="$LastRow - $FirstRow + 1" />
                    </xsl:call-template></div>
                <script type="text/javascript" src="/_layouts/15/jquery-1.8.2.min.js"></script>
                <script type="text/javascript" src="/_layouts/mediaplayer.js"></script>
                <script type="text/javascript">

_spBodyOnLoadFunctionNames.push( 'mediaPlayer.createOverlayPlayer');
mediaPlayer.attachToMediaLinks(document.getElementById('mediaplayer'),['wmv','avi','mp4']);

            </td></tr></table>
        </xsl:otherwise>
                            </xsl:choose>
                            <xsl:call-template name="dvt_1.commandfooter">
                                <xsl:with-param name="FirstRow" select="$FirstRow" />
                                <xsl:with-param name="LastRow" select="$LastRow" />
                                <xsl:with-param name="RowLimit" select="$RowLimit" />
                                <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
                                <xsl:with-param name="RealLastRow" select="number(ddwrt:NameChanged('',-100))" />
                            </xsl:call-template>
                    </xsl:template>
                        <xsl:template name="dvt_1.body">
                            <xsl:param name="Rows"/>
                            <xsl:param name="FirstRow" />
                            <xsl:param name="LastRow" />
                            <xsl:for-each select="$Rows">
                                <xsl:variable name="dvt_KeepItemsTogether" select="false()" />
                                <xsl:variable name="dvt_HideGroupDetail" select="false()" />
                                <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $dvt_KeepItemsTogether">
                                    <xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">
                                        <xsl:call-template name="dvt_1.rowview" />
                                </xsl:if>
                            </xsl:if>
                        </xsl:for-each>
</xsl:template>
                        <xsl:template name="dvt_1.rowview">
                <a href="{@Url}"><xsl:value-of select="@Title"/></a><hr style="background-color:black"></hr>    
            </xsl:template>
                        <xsl:template name="dvt_1.empty">
                            <xsl:variable name="dvt_ViewEmptyText">There are no items to show in this view.</xsl:variable>
    <table border="0" width="100%">
        <tr>
            <td class="ms-vb">
                <xsl:value-of select="$dvt_ViewEmptyText"/>
            </td>
        </tr>
    </table>
</xsl:template>
                        <xsl:template name="dvt_1.commandfooter">
                            <xsl:param name="FirstRow" />
                            <xsl:param name="LastRow" />
                            <xsl:param name="RowLimit" />
                            <xsl:param name="dvt_RowCount" />
                            <xsl:param name="RealLastRow" />
                        <table cellspacing="0" cellpadding="4" border="0" width="100%">
        <tr>
            <xsl:if test="$FirstRow &gt; 1 or $dvt_nextpagedata">
                <xsl:call-template name="dvt_1.navigation">
                    <xsl:with-param name="FirstRow" select="$FirstRow" />
                    <xsl:with-param name="LastRow" select="$LastRow" />
                    <xsl:with-param name="RowLimit" select="$RowLimit" />
                    <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
                    <xsl:with-param name="RealLastRow" select="$RealLastRow" />
                </xsl:call-template>
            </xsl:if>
                            </tr>
    </table>
                    </xsl:template>
                        <xsl:template name="dvt_1.navigation">
                            <xsl:param name="FirstRow" />
                            <xsl:param name="LastRow" />
                            <xsl:param name="RowLimit" />
                            <xsl:param name="dvt_RowCount" />
                            <xsl:param name="RealLastRow" />
                            <xsl:variable name="PrevRow">
                                <xsl:choose>
                                    <xsl:when test="$FirstRow - $RowLimit &lt; 1">1</xsl:when>
                                    <xsl:otherwise>
                <xsl:value-of select="$FirstRow - $RowLimit" />
            </xsl:otherwise>
                                </xsl:choose>
                        </xsl:variable>
                            <xsl:variable name="LastRowValue">
                                <xsl:choose>
                                    <xsl:when test="$LastRow &gt; $RealLastRow">
                <xsl:value-of select="$LastRow"></xsl:value-of>
            </xsl:when>
                                    <xsl:otherwise>
                <xsl:value-of select="$RealLastRow"></xsl:value-of>
            </xsl:otherwise>
                                </xsl:choose>
                        </xsl:variable>
                            <xsl:variable name="NextRow">
        <xsl:value-of select="$LastRowValue + 1"></xsl:value-of>
    </xsl:variable>
                        <td nowrap="nowrap" class="ms-paging" align="right">
                            <xsl:if test="$dvt_firstrow &gt; 1" ddwrt:cf_ignore="1">
            <a>
                                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent('dvt_firstrow={1};dvt_startposition={}')" />;</xsl:attribute>
                                Start</a>
                                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                                <a>
                                <xsl:attribute name="href">javascript: history.back();</xsl:attribute>
                                <img src="/_layouts/15/images/prev.gif" border="0" alt="Previous" />
                                </a>
                                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                            </xsl:if>
                            <xsl:value-of select="$FirstRow" />
                             - <xsl:value-of select="$LastRowValue" />
                            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&amp;nbsp;</xsl:text>

                            <xsl:if test="$LastRowValue &lt; $dvt_RowCount or string-length($dvt_nextpagedata)!=0" ddwrt:cf_ignore="1">
            <a>
                                <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$NextRow,'};dvt_startposition={',$dvt_nextpagedata,'}'))" />;</xsl:attribute>
                                <img src="/_layouts/15/images/next.gif" border="0" alt="Next" />
                                </a>
        </xsl:if>
                        </td>
                    </xsl:template>
                </xsl:stylesheet>

0 个答案:

没有答案