New item link in pop-up window

18/10/2013 16:53

New item link for Content Query Web Part to open in popup window

This is a part of Xslt of Main
plusIcon.png and MyStyle.css is uploaded to /Style library/MyFolder

 <xsl:template match="/">
  <link rel="stylesheet" type="text/css" href="/Style library/MyFolder/MyStyle.css"/>
  <h2>Aktuality</h2>
    <xsl:call-template name="OuterTemplate" />
     <!--'New Item' for current list-->
     <xsl:variable name="ListId">
       <xsl:value-of select="dsQueryResponse/Rows/Row/@ListId" />
  </xsl:variable>
     <xsl:variable name="newItemLink">
      <xsl:value-of select="concat('/_layouts/listform.aspx?PageType=8&amp;ListId={', $ListId, '}&amp;RootFolder=')"/>
     </xsl:variable>
    <!--New item link-->
 <xsl:variable name="onclickValue">SP.UI.ModalDialog.showModalDialog({url: &#39;/_layouts/listform.aspx?PageType=8&amp;ListId={<xsl:value-of select="$ListId"/>}&amp;RootFolder=&#39;, title: &#39;New Item&#39;, allowMaximize: true,showClose: true});return false;</xsl:variable>
    <div class="addNewItemLink">
      <img src="/style library/myfolder/plusIcon.png" />
      <a id="idHomePageNewAnnouncement" class="ms-addnew" target="_self">
       <xsl:attribute name="onclick">
        <xsl:value-of select="$onclickValue"/>
       </xsl:attribute>
       <xsl:attribute name="href">
        <xsl:value-of select="$newItemLink"/>
       </xsl:attribute>
       Add new item
      </a>
    </div>
    </xsl:template>