123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (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 IBM Corp. 2009 2011Rights Reserved. -->
- <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <xts:block id="catalog" processor="XML" type="exec" mode="input"
- path="/iwidget/iwidget_catalog.xml"/>
-
- <xts:block id="response" processor="XSLT" type="exec" mode="interpret"
- dependency="catalog" nodelist="env,http,cookies,interfaces,catalog">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
- xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"
- xmlns:cpsValidate="java:com.cognos.portal.fragment.validation.ValidationManager"
- exclude-result-prefixes="xts xtsext xos iw cpsValidate">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:key name="catalog" match="/root/catalog/entry" use="path"/>
- <xsl:variable name="interfaceInfo" select="/root/interfaces/interfaceInfo[param[@name = 'name'] = 'iwidget']"/>
- <xsl:variable name="remaining" select="$interfaceInfo/param[@name = 'extraInfo']"/>
- <xsl:variable name="entry-path" select="substring-after($remaining, '/bridge')"/>
- <xsl:variable name="entry" select="key('catalog', $entry-path)"/>
- <xsl:variable name="gateway" select="/root/http/param[@name = 'SCRIPT_NAME']"/>
- <xsl:variable name="webcontent" select="/root/http/param[@name = 'WEB_CONTENT_ROOT']"/>
-
- <xsl:variable name="http-host" select="/root/http/param[@name = 'HTTP_HOST']"/>
- <xsl:variable name="http-protocol" select="/root/http/param[@name = 'SERVER_PROTOCOL']"/>
- <xsl:variable name="host">
- <xsl:choose>
- <xsl:when test="starts-with($http-protocol, 'HTTPS')">https://</xsl:when>
- <xsl:otherwise>http://</xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="$http-host"/>
- </xsl:variable>
- <xsl:variable name="bridge-gateway" select="concat($host, $gateway)"/>
- <xsl:variable name="bridge-webcontent" select="concat($host, $webcontent)"/>
-
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/output">
- <xsl:choose>
- <xsl:when test="$remaining = '/sample'">
- <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <iw:iwidget name="sample" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"
- allowInstanceContent="true"
- supportedModes="view"
- mode="view" lang="en">
- <iw:content mode="view"><![CDATA[
- <div id="FRAG_IWID_content" style="height:100%">
- <br><br><br>
- <center>
- <h2>Sample iWidget</h2>
- </center>
- <br><br><br>
- <a href="javascript:alert(iContext.io)">test</a>
- <br><br><br>
- </div>]]>
- </iw:content>
- </iw:iwidget>
- </xos:entityBody>
- </xos:part>
- </xsl:when>
- <xsl:when test="$entry">
- <!-- iWidget -->
- <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <iw:iwidget name="{ $entry/title }" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"
- iScope="com.ibm.cognos.bux.fragmentBridge"
- allowInstanceContent="true"
- supportedModes="view edit"
- mode="view" lang="en">
- <!-- copy metadata -->
- <xsl:copy-of select="$entry/iwidget/*"/>
-
- <iw:event id="com.ibm.bux.widgetchrome.toolbar.init" description="com.ibm.bux.widgetchrome.toolbar.initDesc" published="true" />
- <iw:eventDescription id="com.ibm.bux.widgetchrome.toolbar.initDesc" payloadType="any" description="Event to initialize chrome toolbar." />
-
- <iw:event id="com.ibm.bux.widget.toolbar.action" description="com.ibm.bux.widget.toolbar.actionDesc" handled="true" onEvent="onToolbarAction" />
- <iw:eventDescription id="com.ibm.bux.widget.toolbar.actionDesc" payloadType="any" description="Event for toolbar actions." />
- <iw:event id="com.ibm.bux.widget.refresh" description="com.ibm.bux.widget.refreshDesc" handled="true" onEvent="onWidgetRefresh"/>
- <iw:eventDescription id="com.ibm.bux.widget.refreshDesc" payloadType="any" description="Event for refreshing widget."/>
-
-
- <iw:event id="com.ibm.bux.widget.resize" description="com.ibm.bux.widget.resize" handled="true" onEvent="onWidgetResize"/>
- <iw:eventDescription id="com.ibm.bux.widget.resizeDesc" payloadType="any" description="Event for resizing widget."/>
-
-
- <iw:resource uri="fragmentBridge.js"/>
- <iw:content mode="view">
- <div id="FRAG_IWID_content" class="cogstyle-portlet-content" style="height:100%"><![CDATA[
- <table dojoAttachPoint="loadNode" waiRole="region" tabindex="-1" border="0" cellpadding="0" cellspacing="0" class="widget_loadContainerOuter">
- <tr><td class="widget_loadContainer">
- <div class="widget_loadContainerInsert">
- <div class="dijitInline widget_load"></div>
- </div>
- </td></tr>
- </table>]]>
- <script>
- iContext.bridgeConfig =
- {
- fragmentPath: "<xsl:value-of select="substring-after($entry/path, '/dashboard')"/>",
- gateway: "<xsl:value-of select="$gateway"/>",
- application: "/dashboard",
- webContent: "<xsl:value-of select="$webcontent"/>",
- bridgeGateway: "<xsl:value-of select="cpsValidate:staticSign(cpsValidate:getInstance(), $bridge-gateway)"/>",
- bridgeWebContent: "<xsl:value-of select="cpsValidate:staticSign(cpsValidate:getInstance(), $bridge-webcontent)"/>"
- };
- </script>
- </div>
- </iw:content>
- <iw:content mode="edit"><![CDATA[
- <div id="FRAG_IWID_edit_content" fragmentid="FRAG_IWID_" class="cogstyle-portlet-content" style="height:100%">
- <table dojoAttachPoint="loadNode" waiRole="region" tabindex="-1" border="0" cellpadding="0" cellspacing="0" class="widget_loadContainerOuter">
- <tr><td class="widget_loadContainer">
- <div class="widget_loadContainerInsert">
- <div class="dijitInline widget_load"></div>
- </div>
- </td></tr>
- </table>
- </div>]]>
- </iw:content>
- </iw:iwidget>
- </xos:entityBody>
- </xos:part>
- </xsl:when>
- <xsl:when test="contains($remaining, '.js')">
- <!-- javascript -->
- <xsl:variable name="document">
- <xsl:choose>
- <xsl:when test="contains($remaining, 'fragments.js')">
- <xsl:text>/iwidget/fragments.js</xsl:text>
- </xsl:when>
- <xsl:when test="contains($remaining, 'fragments_patch.js')">
- <xsl:text>/iwidget/fragments_patch.js</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/iwidget/fragmentBridge.js</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xts:request protocol="FILEREAD" target="{ $document }" option="part" mimeType="application/x-javascript"/>
- </xsl:when>
- <xsl:when test="contains($remaining, '.css')">
- <!-- javascript -->
- <xsl:variable name="document">/iwidget/cognos_content_portlets.css</xsl:variable>
- <xts:request protocol="FILEREAD" target="{ $document }" option="part" mimeType="text/css"/>
- </xsl:when>
- <xsl:when test="$remaining = '/feed'">
- <!-- atom feed -->
- <xts:transform processor="XSLT" src="iwidget/catalogFeed.xslt" option="part" mimeType="application/atom+xml">
- <root>
- <xsl:copy-of select="/root/http | /root/request | /root/catalog"/>
- </root>
- </xts:transform>
- </xsl:when>
- <xsl:when test="$remaining = '/test'">
- <!-- iWidget -->
- <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <xsl:copy-of select="/root"/>
- </xos:entityBody>
- </xos:part>
- </xsl:when>
- <xsl:otherwise>
- <!-- document not found -->
- <xos:statusCode>404</xos:statusCode>
- </xsl:otherwise>
- </xsl:choose>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|