123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2011
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:xts="http://developer.cognos.com/schemas/xts/">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="sequence-parm" match="/root/env/param[@name='sharedPageSequence']" use="substring-before(.,',')"/>
- <xsl:key name="sharedPages-idLookup" match="/root/sharedPagesListForDisplay/pagelet" use="cm:storeID"/>
- <xsl:variable name="publicFolder" select="/root/cm:queryResponse/cm:queryReply[2]/*"/>
- <xsl:variable name="privateFolder" select="/root/cm:queryResponse/cm:queryReply[3]/*"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:delete select="/root/env/param[@name='sharedPageSequence']"/>
- <xts:delete select="/root/env/param[@name='sharedPagesChanged']"/>
- <!-- delete the pager selection -->
- <xts:delete select="/root/env/param[starts-with(@name,'sharedPage_select')]"/>
- <xsl:variable name="changeOp"><xsl:value-of select="/root/env/param[@name='sharedPagesChanged']"/></xsl:variable>
- <xsl:if test="$changeOp = 'addPagelet'">
- <xts:append>
- <AddPageletResponse/>
- </xts:append>
- </xsl:if>
-
- <xsl:choose>
- <!-- this is the case when we choose add current page -->
- <xsl:when test="$changeOp = 'add'">
- <xsl:variable name="addSearchID"><xsl:value-of select="/root/env/param[@name='m_selectedPage']"/></xsl:variable>
- <!-- only add the page in if it is not already in the portalPages -->
- <xsl:if test="not(key('sharedPages-idLookup', $addSearchID))">
- <xts:append select="/root/sharedPagesListForDisplay">
- <pagelet>
- <cm:storeID xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="$addSearchID"/></cm:storeID>
- </pagelet>
- </xts:append>
- </xsl:if>
- </xsl:when>
- <!-- in this case we have added pages using the addpage dialog -->
- <xsl:when test="(./root/newEntries)">
- <!-- lets first check to see if we have duplicate entries -->
- <xsl:for-each select="/root/newEntries/cm:pagelet | /root/newEntries/cm:folder | /root/newEntries/cm:content">
- <xsl:variable name='currentId'><xsl:value-of select="cm:storeID"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="key('sharedPages-idLookup', $currentId)">
- <xts:append>
- <duplicateEntry/>
- </xts:append>
- </xsl:when>
- <xsl:otherwise>
- <xts:append select='/root/sharedPagesListForDisplay'>
- <pagelet>
- <xsl:copy-of select="cm:objectClass"/>
- <xsl:copy-of select="cm:defaultName"/>
- <xsl:copy-of select="cm:permissions"/>
- <xsl:copy-of select="cm:searchPath"/>
- <xsl:copy-of select="cm:storeID"/>
- <xsl:copy-of select="cm:ancestors"/>
- </pagelet>
- </xts:append>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <!-- we have canceled from the add paged dialog -->
- <xsl:when test="(./root/env/param[@name = 'addPageletsMode']) and (./root/morphletResponse/canceled)" >
- <xts:append>
- <AddPageletCancel/>
- </xts:append>
- </xsl:when>
- <!-- reset the sequence to the pages to a new sequence -->
- <xsl:when test="$changeOp = 'resequence'">
- <xts:delete select="/root/sharedPagesListForDisplay"/>
- <xts:append>
- <sharedPagesListForDisplay>
- <xsl:for-each select="/root/env/param[@name='sharedPageSequence']">
- <xsl:variable name="currentId"><xsl:value-of select="substring-after(key('sequence-parm',position()),',')"/></xsl:variable>
- <xsl:copy-of select="/root/sharedPagesListForDisplay/pagelet[cm:storeID = $currentId]"/>
- </xsl:for-each>
- </sharedPagesListForDisplay>
- </xts:append>
- </xsl:when>
- <xsl:when test="$changeOp = 'remove'">
- <xsl:variable name="removeSearchID"><xsl:value-of select="/root/env/param[@name='m_selectedPage']"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="$removeSearchID != ''">
- <xts:delete select="/root/sharedPagesListForDisplay/pagelet[./*[local-name() = 'storeID' and text() = '{$removeSearchID}']]"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- in this case we have a bunch of pages to delete. Since we only have the indexes of the pages the user selected to be delete
- we must first create a list of id's to delete and then do the delete -->
- <xsl:variable name="removeIds">
- <xsl:for-each select="/root/env/param[starts-with(@name,'sharedPage_select_')]">
- <xsl:variable name="pageNumber"><xsl:value-of select="number(substring-after(@name,'sharedPage_select_'))"/></xsl:variable>
- <xsl:value-of select="/root/sharedPagesListForDisplay/pagelet[number($pageNumber)]/cm:storeID"/>,<xsl:text/>
- </xsl:for-each>
- </xsl:variable>
- <xts:delete select="/root/sharedPagesListForDisplay/pagelet[contains('{$removeIds}', ./*[local-name() ='storeID'])]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$changeOp = 'addprivate'">
- <xts:append select='/root/sharedPagesListForDisplay'>
- <pagelet>
- <xsl:copy-of select="$privateFolder/cm:storeID"/>
- <!-- the values below are for display purposes only and do not get stored in CM -->
- <!-- the only value used by cm for pagelets is storeID -->
- <xsl:copy-of select="$privateFolder/cm:objectClass"/>
- <!-- add private is only called from the admin pages. In this case we display "Personal Folder" for the the My folders -->
- <!-- so that the administrator gets a consistent view of the user or profile's my folders tab -->
- <cm:defaultName xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"><xts:string id="IDS_MYPAGES_PERSONAL_FOLDER"/></cm:defaultName>
- <xsl:copy-of select="$privateFolder/cm:permissions"/>
- <xsl:copy-of select="$privateFolder/cm:searchPath"/>
- <xsl:copy-of select="$privateFolder/cm:ancestors"/>
- </pagelet>
- </xts:append>
- </xsl:when>
- <xsl:when test="$changeOp = 'addpublic'">
- <xts:append select='/root/sharedPagesListForDisplay'>
- <pagelet>
- <xsl:copy-of select="$publicFolder/*"/>
- </pagelet>
- </xts:append>
- </xsl:when>
- </xsl:choose>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
|