123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2014
- 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/producer/logicsheets/cps-ui-ext.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:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
- xmlns:uix="http://developer.cognos.com/schemas/cps/logic/ui-ext/1/"
- xmlns:utml="http://developer.cognos.com/schemas/cps/logic/form/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- List of supported tags (see each template for details):
- uix:script-isValidURL
- uix:script-isValidChannel
- uix:script-isValidNumber
- uix:script-isValidBoundary
- uix:title
- uix:section-divider
- uix:open-links
- -->
- <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="uix:script-trim" priority="1">
- <script language="javascript">
- <![CDATA[
- //-- Removes leading and trailing spaces
- function wsrp_rewrite_trim(s)
- {
- var j = s.length;
- for (var i = 0; i < j; i++)
- if (s.charAt(i) != ' ')
- break;
-
- if (i < j - 1)
- for (; j > i; j--)
- if (s.charAt(j - 1) != ' ')
- break;
-
- return s.substring(i, j);
- }
- ]]>
- </script>
- </xsl:template>
-
- <xsl:template match="uix:script-isValidURL" priority="1">
- <script language="javascript">
- <![CDATA[
- function wsrp_rewrite_isValidURL(url, mandatory, checkBadChars)
- {
- if (url.length == 0 && mandatory == false) {
- // a blank is fine only if the option is not selected
- return true;
- }
- var sep = url.indexOf("//");
- var protocol = url.substring(0, sep).toLowerCase();
- var badChars = false;
- if (checkBadChars) {
- for (i = 0; i < url.length; i++) {
- var n = url.charCodeAt(i);
- if ( n <= 32 || n > 127 ) {
- badChars = true;
- break;
- }
- }
- }
- return ( ( (protocol == "http:") || (protocol == "https:") ) && (!badChars) && (url.length > sep + 2) );
- }
- ]]>
- </script>
- </xsl:template>
- <xsl:template match="uix:script-isValidChannel" priority="1">
- <script language="javascript">
- <![CDATA[
- function wsrp_rewrite_isValidChannel(channel, mandatory)
- {
- if (channel.length == 0 && mandatory == false) {
- // a blank is fine only if the option is not selected
- return true;
- }
- return (channel.length > 0) && (channel.length < 129) && (channel.match(new RegExp("[^A-Za-z0-9_]")) == null);
- }
- ]]>
- </script>
- </xsl:template>
- <xsl:template match="uix:script-isValidNumber" priority="1">
- <script language="javascript">
- <![CDATA[
- function wsrp_rewrite_isValidNumber(value, percentage)
- {
- var pct = false;
- var l = value.length;
- if (value.charAt(l - 1) == '%' && (percentage == true)) {
- // percentage validation
- pct = true;
- value = value.substring(0, l - 1);
- }
- // validate the number
- var n = Math.round(new Number(value));
- if (new Number(n).toString() != value) {
- return false;
- }
- if (pct && (n < 1 || n > 100)) {
- return false;
- }
- return true;
- }
- ]]>
- </script>
- </xsl:template>
-
- <xsl:template match="uix:script-isValidBoundary" priority="1">
- <script language="javascript">
- <![CDATA[
- function wsrp_rewrite_isValidBoundary(value, min, max,allowSpace)
- {
- if (value == "" && allowSpace){
- return true;
- }
- var n = Math.round(new Number(value));
- if (new Number(n).toString() == value && n >= min && n <= max) {
- return true;
- }
- return false;
- }
- ]]>
- </script>
- </xsl:template>
- <xsl:template match="uix:title" priority="1">
- <utml:exclude-prefix>p_title_</utml:exclude-prefix>
- <out:variable name="locales" select="/root/configuration/property[@name='contentLocales']/locale"/>
- <script language="javascript">
- <![CDATA[
- function wsrp_rewrite_setlang(x)
- {
- var cForm = document.wsrp_rewrite_form;
- var selectedLang = x.options[x.selectedIndex].value;
- if (selectedLang == "-") {
- x.selectedIndex = 0;
- selectedLang = x.options[0].value;
- }
- if (selectedLang != "-") {
- cForm.tmp_title.disabled = false;
- var curTitleLang = cForm["p_title_" + selectedLang];
- if ( curTitleLang != null ) {
- cForm.tmp_title.value = curTitleLang.value;
- }
- } else {
- cForm.tmp_title.disabled = true;
- }
- }
- function wsrp_rewrite_savelang(x)
- {
- var cForm = document.wsrp_rewrite_form;
- var sep,i,j;
- for (i=0; i<cForm.tmp_lang.options.length; i++) {
- if (cForm.tmp_lang.options[i].value == "-") {
- sep = cForm.tmp_lang.options[i];
- break;
- }
- }
-
- var curOption = cForm.tmp_lang.options[cForm.tmp_lang.selectedIndex];
- var selectedLang = curOption.value;
- cForm["p_title_" + selectedLang].value = x.value;
- if (cForm.tmp_lang.selectedIndex > i) {
- cForm.tmp_lang.removeChild(curOption);
- for (j=0; j<i; j++) {
- if (cForm.tmp_lang.options[j].text > curOption.text) {
- cForm.tmp_lang.insertBefore(curOption, cForm.tmp_lang.options[j]);
- cForm.tmp_lang.selectedIndex = j;
- return;
- }
- }
- cForm.tmp_lang.insertBefore(curOption, sep);
- cForm.tmp_lang.selectedIndex = i;
- }
- }
- function wsrp_rewrite_removelang()
- {
- var cForm = document.wsrp_rewrite_form;
- var curOption = cForm.tmp_lang.options[cForm.tmp_lang.selectedIndex];
- var selectedLang = curOption.value;
- if (selectedLang != "-") {
- cForm["p_title_" + selectedLang].value = "";
- cForm.tmp_title.value = "";
- var sep;
- for (i=0; i<cForm.tmp_lang.options.length;i++) {
- if (sep != null) {
- if (cForm.tmp_lang.options[i].text > curOption.text) {
- var insertPoint = cForm.tmp_lang.options[i];
- cForm.tmp_lang.removeChild(curOption);
- cForm.tmp_lang.insertBefore(curOption,insertPoint);
- break;
- }
- } else if (cForm.tmp_lang.options[i].value == "-") {
- sep = cForm.tmp_lang.options[i];
- }
- }
- cForm.tmp_lang.selectedIndex = 0;
- wsrp_rewrite_setlang(cForm.tmp_lang);
- }
- }
- ]]>
- </script>
- <out:variable name="visited" select="$ui-navigational-params[@name = 'edit_visited'] = 'true'"/>
- <out:variable name="tmp-lang" select="$ui-navigational-params[@name = 'tmp_lang']"/>
- <out:for-each select="$locales">
- <utml:input name="p_title_{ '{' } id { '}' }" type="hidden">
- <utml:value>
- <out:variable name="name"><out:if test="$visited">p_</out:if>title_<out:value-of select="id"/></out:variable>
- <out:choose>
- <out:when test="$visited">
- <out:choose>
- <out:when test="id = $tmp-lang">
- <out:value-of select="$ui-navigational-params[@name = 'tmp_title']"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$ui-navigational-params[@name = $name]"/>
- </out:otherwise>
- </out:choose>
- </out:when>
- <out:otherwise>
- <out:value-of select="$ui-state-params[@name = $name]"/>
- </out:otherwise>
- </out:choose>
- </utml:value>
- </utml:input>
- </out:for-each>
- <ui:page-sub-section-group>
- <out:variable name="user-locale" select="/root/titleLocale"/>
- <out:variable name="locales-in-nav" select="$locales[concat('p_title_',id) = $ui-navigational-params[starts-with(@name, 'p_title_') and .!='']/@name]"/>
- <out:variable name="locales-in-state" select="$locales[(concat('title_',id) = $ui-state-params[starts-with(@name, 'title_') and .!='']/@name) or (id = $user-locale and not($ui-state-params[starts-with(@name, 'title_')] != ''))]"/>
- <ui:page-sub-section>
- <ui:page-sub-section-title><label for="wsrp_rewrite_cpsLangSel"><xts:string id="IDS_PRO_UIX_LABEL_LANGUAGE"/></label></ui:page-sub-section-title>
- <ui:page-sub-section-content>
- <table border="0" cellspacing="0" cellpadding="1" role="presentation">
- <tr>
- <td class="portlet-font">
- <utml:select id="wsrp_rewrite_cpsLangSel" name="tmp_lang" size="1" onchange="wsrp_rewrite_setlang(this)" class="portlet-form-field">
- <xsl:if test="@onfocus">
- <xsl:attribute name="onfocus"><xsl:value-of select="@onfocus"/></xsl:attribute>
- </xsl:if>
- <utml:default-value>
- <out:value-of select="$user-locale"/>
- </utml:default-value>
- <out:choose>
- <out:when test="$visited">
- <out:for-each select="$locales-in-nav">
- <out:sort select="displayName" order="ascending"/>
- <utml:option>
- <utml:value>
- <out:value-of select="id"/>
- </utml:value>
- <out:value-of select="displayName"/>
- </utml:option>
- </out:for-each>
- <utml:option value="-">--------------------------------------</utml:option>
- <out:for-each select="$locales[not(id = $locales-in-nav/id)]">
- <out:sort select="displayName" order="ascending"/>
- <utml:option>
- <utml:value>
- <out:value-of select="id"/>
- </utml:value>
- <out:value-of select="displayName"/>
- </utml:option>
- </out:for-each>
- </out:when>
- <out:otherwise>
- <out:for-each select="$locales-in-state">
- <out:sort select="displayName" order="ascending"/>
- <utml:option>
- <utml:value>
- <out:value-of select="id"/>
- </utml:value>
- <out:value-of select="displayName"/>
- </utml:option>
- </out:for-each>
- <utml:option value="-">--------------------------------------</utml:option>
- <out:for-each select="$locales[not(id = $locales-in-state/id)]">
- <out:sort select="displayName" order="ascending"/>
- <utml:option>
- <utml:value>
- <out:value-of select="id"/>
- </utml:value>
- <out:value-of select="displayName"/>
- </utml:option>
- </out:for-each>
- </out:otherwise>
- </out:choose>
- </utml:select>
-  
- <a href="javascript:wsrp_rewrite_removelang()">
- <xsl:attribute name="xsl:use-attribute-sets">anchor</xsl:attribute>
- <out:text/><xts:string id="IDS_PRO_UIX_LINK_REMOVE_LANGUAGE"/></a>
- </td>
- </tr>
- </table>
- </ui:page-sub-section-content>
- </ui:page-sub-section>
- <ui:page-sub-section tailing-space="false">
- <ui:page-sub-section-title><label for="wsrp_rewrite_cpsLangSelTitle"><xts:string id="IDS_PRO_UIX_LABEL_TITLE"/></label></ui:page-sub-section-title>
- <ui:page-sub-section-content>
- <table border="0" cellspacing="0" cellpadding="1">
- <xsl:if test="@style = '2'">
- <tr>
- <td class="portlet-form-field"><xts:string id="IDS_PRO_UIX_LABEL_TYPE_TITLE"/></td>
- </tr>
- </xsl:if>
- <tr>
- <td>
- <utml:input id="wsrp_rewrite_cpsLangSelTitle" name="tmp_title" type="text" size="40" onblur="wsrp_rewrite_savelang(this)" class="portlet-form-input-field">
- <xsl:if test="@onfocus">
- <xsl:attribute name="onfocus"><xsl:value-of select="@onfocus"/></xsl:attribute>
- </xsl:if>
- <utml:value>
- <out:variable name="name">title_<out:value-of select="$user-locale"/></out:variable>
- <out:choose>
- <out:when test="$ui-navigational-params[@name = $name]">
- <out:value-of select="$ui-navigational-params[@name = $name]"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$ui-state-params[@name = $name]"/>
- </out:otherwise>
- </out:choose>
- </utml:value>
- </utml:input>
- </td>
- </tr>
- </table>
- </ui:page-sub-section-content>
- </ui:page-sub-section>
- </ui:page-sub-section-group>
- </xsl:template>
- <xsl:template match="uix:section-divider" priority="1">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td class="portlet-form-field-label" nowrap="nowrap"><xts:string id="{@string}"/> </td>
- <td width="100%"><hr size="1"/></td>
- </tr>
- </table>
- </xsl:template>
- <xsl:template match="uix:open-links" priority="1">
- <xsl:param name="form">wsrp_rewrite_form</xsl:param>
- <ui:property name="open-links" select="'open_links'"/>
- <ui:property name="channel" select="'channel'"/>
- <ui:property name="target" select="'target'"/>
- <script language="javascript">
- function wsrp_rewrite_open_links_select(id)
- {
- document.getElementById(id).checked = true;
- }
- </script>
- <utml:radio-group name="p_open_links">
- <utml:default-value>
- <out:value-of select="$open-links"/>
- </utml:default-value>
- <table border="0" cellspacing="0" cellpadding="1" role="radiogroup" >
- <out:attribute name="aria-label"><xts:string id="{@rgLabel}"/></out:attribute>
- <tr>
- <td valign="top" class="portlet-form-field">
- <utml:input type="radio" class="portlet-form-field" aria-labelledby="wsrp_rewrite_IDS_PRO_UIX_LABEL_NEW_WINDOW">
- <utml:value>
- <out:choose>
- <out:when test="$open-links='current' and $ui-is-myportal">
- <out:text>current</out:text>
- </out:when>
- <out:otherwise>
- <out:text>new</out:text>
- </out:otherwise>
- </out:choose>
- </utml:value>
- </utml:input>
- </td>
- <td class="portlet-form-field" id="wsrp_rewrite_IDS_PRO_UIX_LABEL_NEW_WINDOW"><xts:string id="IDS_PRO_UIX_LABEL_NEW_WINDOW"/></td>
- </tr>
- <out:if test="not($ui-is-myportal)">
- <tr>
- <td valign="top" class="portlet-form-field">
- <utml:input aria-labelledby="wsrp_rewrite_IDS_PRO_UIX_LABEL_CURRENT_WINDOW" type="radio" value="current" class="portlet-form-field"/>
- </td>
- <td class="portlet-form-field" id="wsrp_rewrite_IDS_PRO_UIX_LABEL_CURRENT_WINDOW"><xts:string id="IDS_PRO_UIX_LABEL_CURRENT_WINDOW"/></td>
- </tr>
- </out:if>
- <tr>
- <td valign="top" class="portlet-form-field" rowspan="2">
- <utml:input type="radio" aria-labelledby="wsrp_rewrite_IDS_PRO_UIX_LABEL_TARGET_WINDOW" id='wsrp_rewrite_radio_target' value="target" class="portlet-form-field"/>
- </td>
- <td class="portlet-form-field" id="wsrp_rewrite_IDS_PRO_UIX_LABEL_TARGET_WINDOW"><xts:string id="IDS_PRO_UIX_LABEL_TARGET_WINDOW"/></td>
- </tr>
- <tr>
- <td>
- <utml:input aria-labelledby="wsrp_rewrite_IDS_PRO_UIX_LABEL_TARGET_WINDOW" name="p_target" type="text" size="40" class="portlet-form-input-field" onfocus="wsrp_rewrite_open_links_select('wsrp_rewrite_radio_target')">
- <utml:value>
- <out:value-of select="$target"/>
- </utml:value>
- </utml:input>
- </td>
- </tr>
- <tr>
- <td valign="top" class="portlet-form-field" rowspan="3">
- <utml:input type="radio" aria-labelledby="wsrp_rewrite_IDS_PRO_UIX_LABEL_CHANNEL" id='wsrp_rewrite_radio_channel' value="channel" class="portlet-form-field"/>
- </td>
- <td class="portlet-form-field" id="wsrp_rewrite_IDS_PRO_UIX_LABEL_CHANNEL"><xts:string id="IDS_PRO_UIX_LABEL_CHANNEL"/></td>
- </tr>
- <tr>
- <td class="portlet-msg-info"><xts:string id="{ @msgChannel }"/></td>
- </tr>
- <tr>
- <td>
- <utml:input aria-labelledby="wsrp_rewrite_IDS_PRO_UIX_LABEL_CHANNEL" name="p_channel" type="text" size="40" class="portlet-form-input-field" onfocus="wsrp_rewrite_open_links_select('wsrp_rewrite_radio_channel')">
- <utml:value>
- <out:value-of select="$channel"/>
- </utml:value>
- </utml:input>
- </td>
- </tr>
- </table>
- </utml:radio-group>
- </xsl:template>
- <xsl:template match="uix:*" priority="0">
- <xsl:call-template name="uix-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="uix-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>
|