123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <?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 (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:dp="http://developer.cognos.com/schemas/cps/portlets/logicsheets/dialog/presentation/1/"
- xmlns:out="dummy-uri"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- exclude-result-prefixes="dp xtsext xts">
-
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- dp:button
- -->
- <!--
-
- THIS CODE WAS STOLEN FROM /logicsheets/presentation/dialog/presentation.xslt
- -->
- <xsl:variable name="dp-namespace-uri" select="'http://developer.cognos.com/schemas/cps/portlets/logicsheets/dialog/presentation/1/'"/>
- <xsl:template match="dp:variables">
- <!-- Request variables -->
- <out:variable name="user-agent" select="translate(string(/root/userAgent), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
- <out:variable name="browser">
- <out:choose>
- <out:when test="contains($user-agent , 'msie')">ie</out:when> <!-- IE 4.xx and above -->
- <out:when test="contains($user-agent , 'safari/5') and not(contains($user-agent , 'chrome'))">safari</out:when> <!-- Safari user-agent does not contain Chrome -->
- <out:when test="contains($user-agent , 'chrome')">chrome</out:when> <!-- Chrome user-agent contains Safari also -->
- <out:when test="contains($user-agent , 'mozilla/5.0')">moz</out:when> <!-- NS 6.xx and 7.xx -->
- <out:when test="contains($user-agent , 'mozilla/4.')">ns4</out:when> <!-- NS 4.xx -->
- <out:when test="string-length($user-agent) = 0">undefined</out:when>
- <out:otherwise>other</out:otherwise>
- </out:choose>
- </out:variable>
- </xsl:template>
- <xsl:template match="dp:simpleFooter">
- <table width="100%" border="0" cellpadding="0" cellspacing="0" class="">
- <out:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class"><xsl:value-of select="@class"/></xsl:when>
- <xsl:otherwise>dialogButtonBar</xsl:otherwise>
- </xsl:choose>
- </out:attribute>
- <!-- show the buttons -->
- <tr>
- <out:choose>
- <out:when test="$browser='moz'">
- <td width="2" valign="middle">
- <img width="2" alt="">
- <xsl:attribute name="src"><xsl:value-of select="'{$webcontent}'"/>/images/space.gif</xsl:attribute>
- </img>
- </td>
- </out:when>
- <out:otherwise>
- <td width="5" valign="middle">
- <img width="5" alt="">
- <xsl:attribute name="src"><xsl:value-of select="'{$webcontent}'"/>/images/space.gif</xsl:attribute>
- </img>
- </td>
- </out:otherwise>
- </out:choose>
- <td valign="middle">
- <table border="0" cellpadding="1" cellspacing="0">
- <tr>
- <xsl:apply-templates/>
- </tr>
- </table>
- </td>
- <td width="100%"> </td>
- </tr>
- </table>
- </xsl:template>
-
- <!--
- dp:button - buttons, usually in the dp:footer
- -->
- <xsl:template match="dp:button">
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- Add event handlers for "active buttons" -->
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/>_button</xsl:attribute>
- <xsl:attribute name="onmouseover"><xsl:value-of select="@id"/>_mouseaction(this, 'over')</xsl:attribute>
- <xsl:attribute name="onmouseout"><xsl:value-of select="@id"/>_mouseaction(this, 'out')</xsl:attribute>
- <xsl:attribute name="onmousedown"><xsl:value-of select="@id"/>_mouseaction(this, 'down')</xsl:attribute>
- <script language="JavaScript">
- var <xsl:value-of select="@id"/>_enabled = true;
- function <xsl:value-of select="@id"/>_enable()
- {
- <xsl:value-of select="@id"/>_enabled = true;
- document.getElementById('<xsl:value-of select="@id"/>').className = "commandButtonActive";
- }
-
- function <xsl:value-of select="@id"/>_disable()
- {
- <xsl:value-of select="@id"/>_enabled = false;
- document.getElementById('<xsl:value-of select="@id"/>').className = "commandButtonInactive";
- }
-
- function <xsl:value-of select="@id"/>_isEnabled()
- {
- return <xsl:value-of select="@id"/>_enabled;
- }
-
- function <xsl:value-of select="@id"/>_mouseaction(obj, action)
- {
- var isEnabled = <xsl:value-of select="@id"/>_enabled;
- if (isEnabled)
- {
- switch (action)
- {
- case "over": obj.className = 'commandButtonOver'; break;
- case "out": obj.className = 'commandButton'; break;
- case "down": obj.className = 'commandButtonDown'; break;
- default:
- }
- }
- }
- </script>
- </xsl:when>
- <xsl:when test="not(@id) and not(@state='inactive')">
- <xsl:attribute name="onmouseover">this.className = 'commandButtonOver'</xsl:attribute>
- <xsl:attribute name="onmouseout">this.className = 'commandButton'</xsl:attribute>
- <xsl:attribute name="onmousedown">this.className = 'commandButtonDown'</xsl:attribute>
- </xsl:when>
- </xsl:choose>
-
- <!-- Style the button according to state -->
- <xsl:choose>
- <xsl:when test="@state = 'inactive'">
- <xsl:attribute name="class">commandButtonInactive</xsl:attribute>
- <out:choose>
- <out:when test="$browser = 'ie'">
- <out:attribute name="style">padding-right:10px; padding-left:10px; padding-top:2px; padding-bottom:3px;</out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="style">padding-right:5px; padding-left:5px; padding-top:2px; padding-bottom:3px;</out:attribute>
- </out:otherwise>
- </out:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="class">commandButton</xsl:attribute>
- <out:if test="$browser != 'ie'">
- <out:attribute name="style">padding-right:10px; padding-left:10px; padding-top:2px; padding-bottom:3px;</out:attribute>
- </out:if>
- </xsl:otherwise>
- </xsl:choose>
- <tr>
- <td valign="middle" align="center" nowrap="nowrap">
-
- <!-- minimum button width as specified by STAN -->
- <out:variable name="style">
- <out:choose>
- <out:when test="$browser = 'ie'">
- <xsl:choose>
- <xsl:when test="@state = 'inactive'"> <!-- The width fixing image size depends on whether or not the button is active, as the 10px padding applies to different elements in each case -->
- <out:value-of select="'width:50px;'"/>
- </xsl:when>
- <xsl:otherwise>
- <out:value-of select="'width:70px;'"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:when>
- <out:otherwise>
- <out:value-of select="'width:55px;'"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <div>
- <out:attribute name="style"><out:value-of select="$style"/></out:attribute>
- <!--
- The OK button is a bit unique on none ie browsers.
- We like to add extra padding on anchors that wrap 'OK' to beef up the hot spot area.
- -->
- <out:variable name="OKButton">
- <xsl:copy-of select=".//dp:buttonText/child::node()"/>
- </out:variable>
- <xsl:if test="not(@id)">
- <out:attribute name="id">
- <out:choose>
- <out:when test="$browser = 'ie'">btnAnchorIE</out:when>
- <out:when test="$OKButton = 'OK'">btnAnchorWide</out:when>
- <out:otherwise>btnAnchor</out:otherwise>
- </out:choose>
- </out:attribute>
- </xsl:if>
- <!-- Insert the button content text/images -->
- <xsl:apply-templates/>
- </div>
- </td>
- </tr>
- </table>
- </td>
- <td>
- <img height="1" width="10" alt="" src="{'{$webcontent}'}/images/space.gif"/>
- </td>
- </xsl:template>
-
- <!--
- dp:buttonText
- -->
- <xsl:template match="dp:buttonText">
- <xsl:apply-templates/>
- </xsl:template>
- <!--
- * - This next template is required to copy all other elements into the result.
- -->
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|