123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <?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.
- -->
- <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:fragment-vars">
- <out:variable name="fragment-id">
- <!-- Ensure passed-in fragment-id does not contain bad chars -->
- <out:variable name="id" select="/root/env/param[@name='mvcfragment-id']"/>
- <out:if test="translate($id, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-', '') = ''">
- <out:value-of select="$id"/>
- </out:if>
- </out:variable>
- </xsl:template>
-
- <xsl:template match="mvc:include-fragment-controller">
- <script language="javascript">
- <!--
- * Retrieve the N gateway to set the domain for Javascript to work properly between N and N-1 spaces.
- * See also its counterpart: ../portal/mvc/multi-instance.xsl.
- -->
- <out:variable name="mvc-gateway" select="string(/root/mvcSettings/configuration/property[@name='MVC_gateway'])"/>
- <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>
- <out:call-template name="parseDocumentDomain">
- <out:with-param name="url" select="$mvc-gateway"/>
- </out:call-template>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:if test="$domain != ''">
- document.domain = "<out:value-of select="$domain"/>"; // N-1 side
- </out:if>
- </script>
- <script language="javascript" src="{'{$gateway}'}/dashboard/messages/messages/pfmessages?section=JS"/>
- <script language="javascript" src="{'{$webRoot}'}/dojo16/dojo/dojo.js"/>
- <script language="javascript" src="{'{$webRoot}'}/fragments/xdojo/core.js"/>
- <script language="javascript" src="{'{$webRoot}'}/fragments/fragments.js"/>
- <script language="javascript" src="{'{$webRoot}'}/common/framework/validator/CValidator.js"/>
- <script language="javascript" src="{'{$webRoot}'}/fragments/uicommon.js"/>
- <script language="javascript" src="{'{$webRoot}'}/fragments/layout.js"/>
- </xsl:template>
-
- <xsl:template match="mvc:add-fragment-content-div">
- <div id="{'{concat($fragment-id, "content")}'}">
- <xsl:attribute name="style"><xsl:value-of select="@style"/></xsl:attribute>
-
- <div id="{'{concat($fragment-id, "content")}'}_wait" style="display:none"/>
- </div>
- </xsl:template>
-
- <xsl:template match="mvc:add-fragment">
- <out:variable name="mvc-back-url" select="/root/env/param[@name='mvc-back-url']"/>
-
- <xsl:variable name="fragment-name">
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>fragment</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fragment-path">
- <xsl:value-of select="@path"/>
- </xsl:variable>
- <out:if test="$gateway != ''">
- <script language="javascript">
- _F_Config.gateway = "<out:value-of select="$gateway"/>";
- _F_Config.webContent = "<out:value-of select="$webRoot"/>";
- _F_Config.application = "/dashboard";
-
- <out:variable name="error-template">
- <xsl:text/><table style="padding-top:50px;" cellpadding="3"><xsl:text/>
- <xsl:text/><tr><xsl:text/>
- <xsl:text/><td class="formText"><xsl:text/>
- <xsl:text/><img src="<out:value-of select="$image_root"/>msg_error.gif" alt="" title=""/><xsl:text/>
- <xsl:text/></td><xsl:text/>
- <xsl:text/><td class="formText" valign="top"><xsl:text/>
- <xsl:text/><div id="_THIS_errormsg"/><xsl:text/>
- <xsl:text/></td><xsl:text/>
- <xsl:text/></tr><xsl:text/>
- <xsl:text/></table><xsl:text/>
- </out:variable>
-
- ui_error.prototype.template = "<out:value-of select="xtsext:javascriptencode($error-template)"/>";
- </script>
-
- <script language="javascript">
- var fragment_id = "<out:value-of select="xtsext:javascriptencode($fragment-id)"/>";
- var fragment_path = "<out:value-of select="xtsext:javascriptencode({$fragment-path})"/>";
- var <out:value-of select="{$fragment-name}"/> = new fragment(fragment_path, fragment_id);
- var thisFragment = <out:value-of select="{$fragment-name}"/>;
- thisFragment.isMaintainState = true;
- var loadPending = false;
-
- thisFragment.setOnloadHandler(
- function() {
- ui_init();
- retrieve();
- }
- )
-
- function retrieve() {
- loadPending = true;
- setTimeout(function() { wait(true); }, 500);
-
- var cookied_fragstate = parent.mvcGetFragmentState(fragment_id);
- var isCookiedStateValid = (cookied_fragstate != null && cookied_fragstate != "") ? true : false;
-
- if (isCookiedStateValid) {
- thisFragment.isMaintainState=true;
- thisFragment.state = cookied_fragstate;
- } else {
- parent.mvcSetFragmentState(fragment_id + "state", "");
- }
-
- var initial_parameters = (isCookiedStateValid ? "" : parent.mvcGetInitialParams());
- initial_parameters += '&webRoot=<out:value-of select="xtsext:javascriptencode($webRoot)"/>';
- initial_parameters += '&skin=<out:value-of select="xtsext:javascriptencode($user_skin)"/>';
-
- <!-- Set the back url to hold the current N-stack context -->
- thisFragment.mvc_back_url = parent.mvcGetBackURL();
- thisFragment.encoded_mvc_back_url = parent.mvcGetEncodedBackURL();
-
- thisFragment.retrieve(initial_parameters);
- }
-
- xAddEventListener(window, "beforeunload",
- function() {
- parent.remoteFragmentUnloads(thisFragment.state, thisFragment.isMaintainState);
- }
- );
-
- thisFragment.addEventListener("fragment.retrieve.after",
- function(evt) {
- loadPending = false;
- wait(false);
- thisFragment.removeEventListener("fragment.retrieve.after", arguments.callee);
- }
- );
-
- function wait(bShow) {
- var div = document.getElementById(fragment_id + "content" + "_wait");
- if (div != null) {
- if (bShow) {
- if (loadPending) {
- var waitHTML = '<div style="padding-top:50px;">' +
- '<table cellspacing="0" cellpadding="0" border="0" width="100%">' +
- '<tr>' +
- '<td style="text-align:center">' +
- '<img src="{'{$image_root}'}progress.gif" title="" alt=""/><br/>' +
- '<span class="formText"><xts:string id="IDS_WAIT"/></span>' +
- '</td>' +
- '</tr>' +
- '</table>' +
- '</div>';
- div.innerHTML = waitHTML;
- div.style.display = "";
- }
- } else {
- if (div.style.display != "none") {
- div.style.display = "none"; // hide
- }
- }
- }
- }
- function clearMVCState(mode) {
- thisFragment.isMaintainState = false;
- }
- </script>
- </out:if>
- </xsl:template>
-
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|