123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2013
- 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).
- -->
- <!-- $Header: //cpscrn/main/templates/cps4/portlets/nav/logicsheets/nav-ui.xslt#1 $ -->
- <!-- $DateTime: 2008/10/22 11:12:04 $ -->
- <!-- $Change: 25109 $ -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:out="dummy-uri"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:nui="http://developer.cognos.com/schemas/cps/logic/nav/ui/1/">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:template match="xsl:stylesheet" priority="1">
- <xsl:copy>
- <xsl:apply-templates select="@*"/>
- <out:attribute-set name="anchor">
- <out:attribute name="class">cognos-anchor</out:attribute>
- <out:attribute name="onmouseover">window.status='';return true;</out:attribute>
- <out:attribute name="onmouseout">window.status='';return true;</out:attribute>
- </out:attribute-set>
- <xsl:apply-templates select="*|text()|processing-instruction()"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="nui:wsrp_rewrite_channel_set" priority="1">
- function wsrp_rewrite_channel_set(id) {
- if (wsrp_rewrite_validate()) {
-
- <!--
- Get the list of all the fragment that read the 'display_id' and destory them so we can clear the state before we communicate the value
- CQCOGCQ00815120
- -->
- if (window._F_WSRP){
- window._F_WSRP.destroyTransientState('display_id', '<out:value-of select="xtsext:javascriptencode(string($channel))"/>');
- }
-
- document.wsrp_rewrite_form.display_id.value = id;
- document.wsrp_rewrite_form.action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=set:<out:value-of select="$channel"/>&wsrp-windowState=<out:value-of select="$ui-window-state"/>/wsrp_rewrite';
- document.wsrp_rewrite_form.submit();
- }
- }
- </xsl:template>
- <xsl:template match="nui:script-validate-range" priority="1">
- <out:variable name="min-range">
- <xsl:choose>
- <xsl:when test="@minRange"><out:value-of select="{@minRange}"/></xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:variable name="max-range">
- <xsl:choose>
- <xsl:when test="@maxRange"><out:value-of select="{@maxRange}"/></xsl:when>
- <xsl:otherwise>2147483646</xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:variable name="max-objects">
- <xsl:choose>
- <xsl:when test="@maxObjects"><out:value-of select="{@maxObjects}"/></xsl:when>
- <xsl:otherwise>10</xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:variable name="from">
- <xsl:choose>
- <xsl:when test="@from"><out:value-of select="{@from}"/></xsl:when>
- <xsl:otherwise>from</xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:variable name="to">
- <xsl:choose>
- <xsl:when test="@to"><out:value-of select="{@to}"/></xsl:when>
- <xsl:otherwise>to</xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <script language="javascript">
- var wsrp_rewrite_errmsg1 = "<xts:string id="IDS_NAV_ERR_FIRST_TOO_SMALL" encode="javascript"><xts:param name="low"><out:value-of select="$min-range"/></xts:param></xts:string>";
- var wsrp_rewrite_errmsg2 = "<xts:string id="IDS_NAV_ERR_FIRST_TOO_BIG" encode="javascript"><xts:param name="high"><out:value-of select="$max-range"/></xts:param></xts:string>";
- var wsrp_rewrite_errmsg3 = "<xts:string id="IDS_NAV_ERR_SECOND_TOO_SMALL" encode="javascript"><xts:param name="low"><out:value-of select="$min-range"/></xts:param></xts:string>";
- var wsrp_rewrite_errmsg4 = "<xts:string id="IDS_NAV_ERR_SECOND_TOO_BIG" encode="javascript"><xts:param name="high"><out:value-of select="$max-range"/></xts:param></xts:string>";
- var wsrp_rewrite_errmsg5 = "<xts:string id="IDS_NAV_ERR_FIRST_BIGGER_SECOND" encode="javascript"/>";
- var wsrp_rewrite_errmsg6 = "<xts:string id="IDS_NAV_ERR_GOTO_VALUE_MISSING" encode="javascript"/>";
- function wsrp_rewrite_validateRange(allowBlank)
- {
- var cForm = document.wsrp_rewrite_form;
- var fromField = cForm.<out:value-of select="$from"/>;
- var toField = cForm.<out:value-of select="$to"/>;
- var maxObjects = <out:value-of select="$max-objects"/> ;
-
- if (fromField != null && toField != null) {
-
- // Make sure that not both fields are empty
- if (allowBlank == null || allowBlank !=true){
- if ( fromField.value == "" && toField.value == "" ) {
- window.alert(wsrp_rewrite_errmsg6);
- fromField.focus();
- return false;
- }
- }
- // validate the first field
- if (!wsrp_rewrite_validateValue( fromField , wsrp_rewrite_errmsg1, wsrp_rewrite_errmsg2)) {
- return false;
- }
-
- // validate the second field
- if (!wsrp_rewrite_validateValue( toField, wsrp_rewrite_errmsg3, wsrp_rewrite_errmsg4)) {
- return false;
- }
- // If one of the fields if empty fill it with the right value
- var fromValue = new Number(fromField.value);
- var toValue = new Number(toField.value);
-
- if ( fromField.value != "" && toField.value == "" ) {
- toValue = fromValue + maxObjects - 1;
- toField.value = toValue ;
- }
- else
- if ( fromField.value == "" && toField.value != "" ) {
- fromValue = toValue - maxObjects + 1;
- if (fromValue < 1){
- fromValue=1;
- }
- fromField.value = fromValue;
- }
-
- // Make sure the first value is less than the second value
- if (fromValue > toValue){
- window.alert(wsrp_rewrite_errmsg5);
- fromField.focus();
- return false;
- }
- }
- return true;
- }
- function wsrp_rewrite_validateValue(field, min_error, max_error)
- {
- var minRange = <out:value-of select="$min-range"/>;
- var maxRange = <out:value-of select="$max-range"/>;
-
- var value = field.value;
- if (value != "") {
- // validate that the entry is a number
- var n = new Number(value);
- if (Math.round(n.valueOf()) != value) {
- window.alert(min_error);
- field.focus();
- return false;
- }
-
- // validate that the entry is in the necessary range
- if ( n <= minRange ) {
- window.alert(min_error);
- field.focus();
- return false;
- }
-
- if ( n >=maxRange ) {
- window.alert(max_error);
- field.focus();
- return false;
- }
-
- }
- return true;
- }
- </script>
- </xsl:template>
- <xsl:template match="nui:*" priority="0">
- <xsl:call-template name="nui-compile-error">
- <xsl:with-param name="errno">0100</xsl:with-param>
- <xsl:with-param name="errmsg">Unsupported logicsheet tag: <xsl:value-of select="local-name(.)"/></xsl:with-param>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="nui-compile-error">
- <xsl:param name="errno"/>
- <xsl:param name="errmsg"/>
- <xsl:message>
- <xsl:text>CPS-ERR-</xsl:text>
- <xsl:value-of select="$errno"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="$errmsg"/>
- <xsl:text>.</xsl:text>
- </xsl:message>
- <xsl:message terminate="yes">
- <xsl:text> ...at: </xsl:text>
- <xsl:for-each select="ancestor-or-self::node()[name()!='']">
- <xsl:text>/</xsl:text>
- <xsl:value-of select="name()"/>
- </xsl:for-each>
- </xsl:message>
- </xsl:template>
- <xsl:template match="*|@*|text()|processing-instruction()" priority="-1">
- <xsl:copy>
- <xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|