123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <?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:out="dummy-uri"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:mvc="http://developer.cognos.com/schemas/xts/mvc"
- xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
- exclude-result-prefixes="mvc xtsext xts cp">
-
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
-
- <xsl:template match="mvc:instance-vars">
- <out:variable name="fragment-id">
- <out:choose>
- <out:when test="/root/search">
- <out:text/>mvcs<out:text/>
- </out:when>
- <out:otherwise>
- <out:choose>
- <out:when test="$isMFNav">mvcmf</out:when>
- <out:otherwise>mvcpf</out:otherwise>
- </out:choose>
- </out:otherwise>
- </out:choose>
- </out:variable>
-
- <out:variable name="rcr-id" select="$rootReply/*/cm:storeID"/>
-
- <out:variable name="cookied-rcr-id">
- <out:variable name="cookied-fragstate">
- <out:choose>
- <out:when test="$mvc-remotePFNav"><out:value-of select="string(/root/cookies/cookie[@name='mvcpfstate'])"/></out:when>
- <out:otherwise><out:value-of select="string(/root/cookies/cookie[@name='mvcmfstate'])"/></out:otherwise>
- </out:choose>
- </out:variable>
-
- <out:choose>
- <out:when test="$mvc-remotePFNav"><out:value-of select="translate(substring-before($cookied-fragstate, ':'), '"', '')"/></out:when>
- <out:otherwise><out:value-of select="translate(substring-before($cookied-fragstate, ':'), '"', '')"/></out:otherwise>
- </out:choose>
- </out:variable>
- </xsl:template>
-
- <xsl:template match="mvc:instance">
- <out:variable name="id" select="{@id}"/>
-
- <script language="javascript">
- <!--
- * Retrieve the N-1 gateway to set the domain for Javascript to work properly between N and N-1 spaces.
- * See also its counterpart: ../portal/mvc/remote/frag-handler.xsl.
- -->
- <out:variable name="domain">
- <out:choose>
- <out:when test="$mvc-domain != ''">
- <!-- Use the configured domain in 'MVC_domain', if specified -->
- <out:value-of select="$mvc-domain"/>
- </out:when>
- <out:otherwise>
- <!-- MVC_domain not specified, parse the gateway -->
- <out:call-template name="parseDocumentDomain">
- <out:with-param name="url" select="$mvc-remote-gateway"/>
- </out:call-template>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:if test="$domain != ''">
- document.domain = "<out:value-of select="$domain"/>"; // N side
- </out:if>
- </script>
-
- <script language="javascript">
- var mvc_frame_id = "<out:value-of select="xtsext:javascriptencode($id)"/>" + "_frame";
- var fragment_id = "<out:value-of select="xtsext:javascriptencode($fragment-id)"/>";
- var rcr_id = "<out:value-of select="xtsext:javascriptencode($rcr-id)"/>";
-
- function remoteFragmentUnloads(frag_state, isMaintainState) {
- var state = null;
-
- if (isMaintainState) {
- if (frag_state != null && frag_state.length > 0) {
- state = frag_state;
- }
- } else {
- state = ""; // clear the state
- }
-
- if (state != null) {
- parent.mvcSetFragmentState(fragment_id + "state", state);
- }
- }
-
- function clearMVCState(mode) {
- var isSearchFragment = (fragment_id.indexOf('mvcs') == 0);
-
- if (mode == "search") {
- delCookie("mvcsstate");
- if (isSearchFragment && document.getElementById(mvc_frame_id) != null) {
- document.getElementById(mvc_frame_id).contentWindow.clearMVCState();
- }
- } else {
- delCookie("mvcpfstate");
- delCookie("mvcmfstate");
- if (!isSearchFragment && document.getElementById(mvc_frame_id) != null) {
- document.getElementById(mvc_frame_id).contentWindow.clearMVCState();
- }
- }
- }
-
- function mvcSetFragmentState(name, state) {
- if (state != '') {
- state = "\"" + rcr_id + ":" + state + "\"";
- }
-
- setCookie(name, state);
- }
-
- function mvcGetFragmentState(fragment_id) {
- var cookied_fragstate = getCookie(fragment_id + "state");
-
- if (cookied_fragstate != null && cookied_fragstate != "") {
- if (cookied_fragstate.indexOf("\"") == 0 && cookied_fragstate.lastIndexOf("\"") == cookied_fragstate.length-1)
- cookied_fragstate = cookied_fragstate.substring(1, cookied_fragstate.length-1);
- var cookied_RCRid = "";
- var idx = cookied_fragstate.indexOf(":");
- if (idx != -1) {
- cookied_RCRid = cookied_fragstate.substring(0, idx);
- cookied_fragstate = cookied_fragstate.substring(idx+1);
- }
- if (cookied_RCRid != rcr_id) {
- cookied_fragstate = "";
- }
- } else {
- cookied_fragstate = "";
- }
-
- return cookied_fragstate;
- }
-
- function mvcGetInitialParams() {
- var initial_parameters = '<out:value-of select="xtsext:javascriptencode(string({@fragment-params}))"/>';
- return initial_parameters;
- }
-
- function mvcGetBackURL() {
- var mvc_back_url = '<out:value-of select="xtsext:javascriptencode($mvc-back-url)"/>';
- return mvc_back_url;
- }
-
- function mvcGetEncodedBackURL() {
- encoded_mvc_back_url = '<out:value-of select="xtsext:javascriptencode($encoded-mvc-back-url)"/>';
- return encoded_mvc_back_url;
- }
-
- function mvcSetNavigationId(id) {
- g_PS_mvcRemoteFolderContext = id;
- }
-
- function mvcGotoCognosRoot() {
- <out:variable name="gotourl">
- <out:value-of select="concat($gateway,'?b_action=xts.run&m=portal/cc.xts')"/>
- <out:text/>&m_folder=<out:text/>
- <out:choose>
- <out:when test="$isPFNav"><out:value-of select="key('session-param', 'prootid')"/></out:when>
- <out:otherwise><out:value-of select="key('session-param', 'mrootid')"/></out:otherwise>
- </out:choose>
- </out:variable>
-
- if (document.getElementById(mvc_frame_id) != null)
- document.getElementById(mvc_frame_id).contentWindow.clearMVCState();
-
- var gotourl = "<out:value-of select="xtsext:javascriptencode($gotourl)"/>";
-
- window.setTimeout("window.location.href='" + gotourl + "';", 10);
- }
-
- function mvcNavigateTo(id) {
- if (document.getElementById(mvc_frame_id) != null)
- document.getElementById(mvc_frame_id).contentWindow.clearMVCState();
- mvcSetFragmentState("mvcsstate", "");
- mvcSetFragmentState("mvcpfstate", "");
- mvcSetFragmentState("mvcmfstate", "");
-
- <out:variable name="navurl">
- <out:value-of select="concat($gateway,'?b_action=xts.run&m=portal/cc.xts')"/>
- <out:text/>&m_folder=<out:value-of select="xtsext:protect(xtsext:urlencode($rcr-id),'url', concat('NAME', 'rcr-id'),'getdata')"/>
- </out:variable>
-
- var navurl = "<out:value-of select="xtsext:javascriptencode($navurl)"/>";
- navurl += "&mvc-sfolder=" + id;
- window.setTimeout("window.location.href='" + navurl + "';", 10);
- }
- </script>
- <!-- Create the iframe to retrieve remote contents -->
- <out:variable name="url">
- <out:value-of select="$mvc-remote-gateway"/>
- <out:text/>?b_action=xts.run<out:text/>
- <out:text/>&m=portal/mvc/remote/<out:value-of select="$id"/>-frame.xts<out:text/>
- <out:text/>&mvcfragment-id=<out:value-of select="$fragment-id"/>
- </out:variable>
- <iframe id="{'{$id}'}_frame" src="{'{$url}'}" width="100%" height="80%" frameborder="0" marginheight="0" marginwidth="2"></iframe>
- </xsl:template>
-
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|