123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- <?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: //cps4/main/src/cps/templates/cps4/portlets/samples/portlet-impl/xmlviewer/edit.xslt#2 $ -->
- <!-- $DateTime: 2004/04/18 10:35:04 $ -->
- <!-- $Change: 8570 $ -->
- <xsl:stylesheet
- exclude-result-prefixes="xts xtsext ui utml"
- version="1.0"
- xmlns:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
- xmlns:utml="http://developer.cognos.com/schemas/cps/logic/form/1/"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:trustedSession="java:com.cognos.portal.utils.TrustedSessionHelper"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
- <!--
- declare global variables...
- -->
- <xsl:variable name="app" select="/root/Application"/>
- <xsl:variable name="sdk-params" select="$app/Param[@Cps = 'true']"/>
- <xsl:variable name="hidden-params" select="$app/Param[not(@Cps = 'true')]"/>
-
- <xsl:variable name="is-web" select="$app/@Component = 'CPSWEB'"/>
- <xsl:variable name="rewrite-functions" select="$app/@namespaceFunctions"/>
- <xsl:variable name="scope" select="$app/@scope"/>
- <xsl:variable name="features" select="$app/@features"/>
- <xsl:variable name="consumer-escape" select="$ui-registration-params[@name = 'consumerEscape']"/>
- <utml:variables/>
- <!--
- create portal variable: $ui-consumer-info
- -->
- <ui:consumer/>
- <xsl:variable name="alias">
- <xsl:choose>
- <xsl:when test="$ui-navigational-params[@name = 'p_alias'] != ''">
- <xsl:value-of select="$ui-navigational-params[@name = 'p_alias']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ui-state-params[@name = 'alias']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="prev-alias">
- <xsl:choose>
- <xsl:when test="key('utml-key-params', 'tmp_prev_alias')">
- <xsl:value-of select="key('utml-key-params', 'tmp_prev_alias')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$alias"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="reset" select="string($alias) != string($prev-alias)"/>
- <xsl:template match="/">
- <script language="javascript">
- function wsrp_rewrite_validate() {
- return true;
- }
- </script>
- <script language="javascript">
- function wsrp_rewrite_chooseApplication() {
- <utml:form-submit
- utml:formName="wsrp_rewrite_form"
- utml:targetPage="listapps"
- utml:operation="push"
- utml:validate="false"/>
- }
- <xsl:if test="$utml-mode = 'cps:config'">
- function wsrp_rewrite_editCommands(cmd) {
- var cForm = document.wsrp_rewrite_form;
- cForm.p_admin_customized.value = cmd;
- <xsl:if test="string( $alias ) != $ui-state-params[@name = 'alias']">
- if (cForm.tmp_prev_alias != null) {
- cForm.tmp_prev_alias.value = "";
- }
- </xsl:if>
- <utml:form-submit
- utml:formName="wsrp_rewrite_form"
- utml:targetPage="edit"
- utml:operation="maintain"
- utml:validate="false"/>
- }
- </xsl:if>
- </script>
- <ui:about/>
- <ui:help/>
- <utml:form name="wsrp_rewrite_form" action="wsrp_rewrite?wsrp-urlType=blockingAction/wsrp_rewrite" method="post" utml:escape-prefix="$consumer-escape" utml:maintainPrevNavState="true">
- <utml:exclude-prefix>p_sdk_</utml:exclude-prefix>
- <utml:exclude>jsessionid</utml:exclude>
-
- <utml:input type="hidden" name="cps-authToken" utml:update="false">
- <utml:value>
- <xsl:value-of select="trustedSession:staticGenerateAuthToken(string(/root/cookies/cookie[@name='usersessionid']))"/>
- </utml:value>
- </utml:input>
- <utml:input type="hidden" name="p_isWeb" utml:update="false">
- <utml:value>
- <xsl:value-of select="$is-web"/>
- </utml:value>
- </utml:input>
- <utml:input type="hidden" name="p_features" utml:update="false">
- <utml:value>
- <xsl:value-of select="$features"/>
- </utml:value>
- </utml:input>
- <utml:input type="hidden" name="p_scope" utml:update="false">
- <utml:value>
- <xsl:value-of select="$scope"/>
- </utml:value>
- </utml:input>
- <utml:input type="hidden" name="p_rewriteFunctions" utml:update="false">
- <utml:value>
- <xsl:value-of select="$rewrite-functions"/>
- </utml:value>
- </utml:input>
-
-
-
- <utml:input type="hidden" name="p_alias" utml:update="false">
- <utml:value>
- <xsl:value-of select="$alias"/>
- </utml:value>
- </utml:input>
- <utml:input type="hidden" name="p_url" utml:update="false">
- <utml:value>
- <xsl:value-of select="$app/Url"/>
- </utml:value>
- </utml:input>
- <utml:input type="hidden" name="tmp_prev_alias" utml:update="false">
- <utml:value>
- <xsl:value-of select="$alias"/>
- </utml:value>
- </utml:input>
- <xsl:if test="$utml-mode != 'cps:config'">
- <xsl:for-each select="$hidden-params">
- <utml:input type="hidden" name="p_sdk_{@Name}" utml:update="false" utml:escape="true">
- <utml:value>
- <xsl:call-template name="get-param-value">
- <xsl:with-param name="param" select="current()"/>
- </xsl:call-template>
- </utml:value>
- </utml:input>
- </xsl:for-each>
- <utml:input name="p_admin_customized" type="hidden" utml:update="false">
- <utml:value>
- <xsl:value-of select="$ui-state-params[@name = 'admin_customized']"/>
- </utml:value>
- </utml:input>
- </xsl:if>
- <ui:page>
- <table border="0" cellspacing="0" cellpadding="2" width="100%">
- <tr>
- <td class="portlet-form-field-label" valign="top">
- <xts:string id="IDS_SDK_EDT_LABEL_NAME"/>
- </td>
- </tr>
- <tr>
- <td class="portlet-form-field" valign="top">
- <xsl:choose>
- <xsl:when test="$app">
- <xsl:value-of select="$app/@Title"/>
- </xsl:when>
- <xsl:otherwise>
- <i><xts:string id="IDS_SDK_EDT_LABEL_NO_APP_SELECTED"/></i>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr>
- <td class="portlet-form-field">
- <a class="cognos-anchor" href="javascript:wsrp_rewrite_chooseApplication();"><xts:string id="IDS_SDK_EDT_LINK_SELECT_APP"/></a>
- <br/><br/>
- </td>
- </tr>
- <xsl:if test="$sdk-params">
- <!--
- render all parameters, except checkboxes, if any.
- -->
- <tr>
- <td>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td class="portlet-form-field-label" nowrap="nowrap"><xts:string id="IDS_SDK_EDT_GROUP_VIEWING_OPTIONS"/> </td>
- <td width="100%"><hr size="1"/></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table border="0" cellspacing="0" cellpadding="2">
- <xsl:for-each select="$sdk-params[@Type != 'boolean']">
- <xsl:call-template name="render-param">
- <xsl:with-param name="param" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- <!--
- if any checkboxes, render them in two columns
- -->
- <xsl:if test="$sdk-params[@Type = 'boolean']">
- <tr>
- <td>
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <xsl:for-each select="$sdk-params[@Type = 'boolean']">
- <xsl:call-template name="render-param-boolean">
- <xsl:with-param name="param" select="."/>
- </xsl:call-template>
- <td>
- <xsl:text>   </xsl:text>
- </td>
- <!--
- close a row, and open a new one
- -->
- <xsl:if test="(position() mod 2) = 0">
- <xsl:text disable-output-escaping="yes"></tr><tr></xsl:text>
- </xsl:if>
- </xsl:for-each>
- <!--
- add the missing TD if needed
- -->
- <xsl:if test="(count( $sdk-params[@Type = 'boolean'] ) mod 2) = 1">
- <td colspan="2">
- <xsl:text> </xsl:text>
- </td>
- </xsl:if>
- </tr>
- </table>
- </td>
- </tr>
- </xsl:if>
- </table>
- </td>
- </tr>
- </xsl:if>
- <xsl:if test="($utml-mode = 'cps:config') and ($app/Param[not(@Cps = 'true')])">
- <!--
- render all the application's parameters, if any. excluding the cps parameters.
- -->
- <tr>
- <td class="portlet-form-field-label">
- <br/>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td class="portlet-form-field-label" nowrap="nowrap"><xts:string id="IDS_SDK_EDT_APP_EXEC_PARAMS"/> </td>
- <td width="100%"><hr size="1"/></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:variable name="override">
- <xsl:choose>
- <xsl:when test="key('utml-key-params', 'p_admin_customized')">
- <!--
- already loaded, check the flag only
- -->
- <xsl:choose>
- <xsl:when test="( key('utml-key-params', 'p_admin_customized') = 'true' ) and ( not($reset) or ( key('utml-key-params', 'tmp_prev_alias') = '' ) )">
- <xsl:value-of select="true()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="false()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$ui-state-params[@name = 'admin_customized'] != ''">
- <xsl:value-of select="$ui-state-params[@name = 'admin_customized']"/>
- </xsl:when>
- <!--
- first time the page is loaded
- -->
- <xsl:otherwise>
- <xsl:value-of select="false()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <utml:input name="p_admin_customized" type="hidden" utml:update="false">
- <utml:value>
- <xsl:value-of select="$override"/>
- </utml:value>
- </utml:input>
- <table border="0" cellspacing="0" cellpadding="2">
- <xsl:choose>
- <xsl:when test="$override = 'true'">
- <xsl:for-each select="$app/Param[not(@Cps = 'true')]">
- <xsl:call-template name="render-param">
- <xsl:with-param name="param" select="current()"/>
- </xsl:call-template>
- </xsl:for-each>
- <tr>
- <td class="portlet-form-field" colspan="3">
- <a class="cognos-anchor" href="javascript:wsrp_rewrite_editCommands('false')"><xts:string id="IDS_SDK_EDT_LINK_REMOVE_CUSTOMIZATION"/></a>
- </td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="$app/Param[not(@Cps = 'true')]">
- <xsl:call-template name="render-param-read-only">
- <xsl:with-param name="param" select="current()"/>
- </xsl:call-template>
- </xsl:for-each>
- <tr>
- <td class="portlet-form-field" colspan="3">
- <a class="cognos-anchor" href="javascript:wsrp_rewrite_editCommands('true')"><xts:string id="IDS_SDK_EDT_LINK_EDIT_COMMANDS"/></a>
- </td>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
- </table>
- </td>
- </tr>
- </xsl:if>
- <!--
- SAP-HACK-START
- -->
- <ui:admin-settings/>
- <!--
- SAP-HACK-END
- -->
- </table>
- </ui:page>
- </utml:form>
- </xsl:template>
- <xsl:template name="render-param">
- <xsl:param name="param" select="current()"/>
- <tr title="{$param/@Description}">
- <td class="portlet-form-field-label" valign="top" nowrap="nowrap">
- <xsl:value-of select="$param/@Label"/>
- </td>
- </tr>
- <tr>
- <td class="portlet-form-field">
- <xsl:choose>
- <xsl:when test="$param/@Type = 'textarea'">
- <xsl:variable name="rows">
- <xsl:choose>
- <xsl:when test="$param/@Rows">
- <xsl:value-of select="$param/@Rows"/>
- </xsl:when>
- <xsl:otherwise>3</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <utml:textarea class="portlet-form-input-field" cols="80" rows="{ $rows }" name="p_sdk_{ $param/@Name }" utml:escape="true" utml:escape-prefix="$consumer-escape">
- <utml:value>
- <xsl:call-template name="get-param-value">
- <xsl:with-param name="param" select="$param"/>
- </xsl:call-template>
- </utml:value>
- </utml:textarea>
- </xsl:when>
- <xsl:when test="$param/@Type = 'enum'">
- <utml:select class="portlet-form-input-field" name="p_sdk_{ $param/@Name }">
- <utml:default-value>
- <xsl:call-template name="get-param-value">
- <xsl:with-param name="param" select="$param"/>
- </xsl:call-template>
- </utml:default-value>
- <xsl:for-each select="Value">
- <utml:option>
- <utml:value>
- <xsl:value-of select="@Name"/>
- </utml:value>
- <xsl:value-of select="."/>
- </utml:option>
- </xsl:for-each>
- </utml:select>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="size">
- <xsl:choose>
- <xsl:when test="$param/@Size">
- <xsl:value-of select="$param/@Size"/>
- </xsl:when>
- <xsl:otherwise>20</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <utml:input class="portlet-form-input-field" type="text" size="{$size}" name="p_sdk_{ $param/@Name }" utml:escape="true" utml:escape-prefix="$consumer-escape">
- <utml:value>
- <xsl:call-template name="get-param-value">
- <xsl:with-param name="param" select="$param"/>
- </xsl:call-template>
- </utml:value>
- </utml:input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:template>
- <xsl:template name="render-param-read-only">
- <xsl:param name="param" select="current()"/>
- <tr title="{$param/@Description}">
- <td class="portlet-form-field" valign="top" nowrap="nowrap">
- <b>
- <xsl:value-of select="$param/@Label"/>
- </b>
- </td>
- <td class="portlet-form-field">
- <xsl:text>  </xsl:text>
- </td>
- <td class="portlet-form-input-field">
- <xsl:choose>
- <xsl:when test="$param/@Type = 'textarea' or $param/@Type = 'text'">
- <xsl:choose>
- <xsl:when test="$param/child::node()">
- <xsl:value-of select="$param/child::node()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$param/@Default"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$param/@Type = 'enum'">
- <xsl:variable name="enum-value">
- <xsl:choose>
- <xsl:when test="$param/@Value">
- <xsl:value-of select="$param/@Value"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$param/@Default"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="Value[normalize-space($param/@Name) = normalize-space($enum-value)]"/>
- </xsl:when>
- </xsl:choose>
- <utml:input type="hidden" name="p_sdk_{$param/@Name}" utml:update="false" utml:escape-prefix="$consumer-escape" utml:escape="true">
- <utml:value>
- <xsl:call-template name="get-param-value">
- <xsl:with-param name="param" select="$param"/>
- <xsl:with-param name="param-reset" select="key('utml-key-params', 'p_admin_customized') != 'true'"/>
- </xsl:call-template>
- </utml:value>
- </utml:input>
- </td>
- </tr>
- </xsl:template>
- <xsl:template name="render-param-boolean">
- <xsl:param name="param" select="current()"/>
- <td class="portlet-form-field" valign="top" title="{$param/@Description}">
- <utml:input type="checkbox" name="p_sdk_{ $param/@Name }" value="true">
- <utml:default-value>
- <xsl:call-template name="get-param-value">
- <xsl:with-param name="param" select="$param"/>
- </xsl:call-template>
- </utml:default-value>
- </utml:input>
- <xsl:value-of select="$param/@Label"/>
- </td>
- </xsl:template>
- <xsl:template name="get-param-value">
- <xsl:param name="param"/>
- <xsl:param name="param-reset" select="$reset"/>
- <xsl:variable name="sdk-name" select="concat( 'sdk_', $param/@Name )"/>
- <xsl:variable name="p-sdk-name" select="concat( 'p_sdk_', $param/@Name )"/>
- <xsl:choose>
- <xsl:when test="not($param-reset) and key( 'utml-key-params', string( $p-sdk-name ) )">
- <xsl:value-of select="key( 'utml-key-params', string( $p-sdk-name ) )"/>
- </xsl:when>
- <!--
- checkboxes don't return a value when they are unchecked
- -->
- <xsl:when test="not($param-reset) and (key( 'utml-key-params', 'edit_visited') = 'true') and ($param/@Type = 'boolean') and not( key( 'utml-key-params', $p-sdk-name ) )">
- <xsl:value-of select="'false'"/>
- </xsl:when>
- <xsl:when test="not($param-reset) and $ui-state-params[@name = $sdk-name]">
- <xsl:value-of select="$ui-state-params[@name = $sdk-name]"/>
- </xsl:when>
- <!--
- CPS 1.0 compatibility: convert cps_xxxx to sdk_cps_xxxx
- -->
- <xsl:when test="not($param-reset) and $ui-state-params[@name = $param/@Name]">
- <xsl:value-of select="$ui-state-params[@name = $param/@Name]"/>
- </xsl:when>
- <!--
- missing checkbox's value when an application is selected, use false
- -->
- <xsl:when test="not($param-reset) and ($alias != '') and ($param/@Type = 'boolean') and not($ui-state-params[@name = $sdk-name])">
- <xsl:value-of select="'false'"/>
- </xsl:when>
- <xsl:when test="$param/text() and not($param/*)">
- <xsl:value-of select="$param/."/>
- </xsl:when>
- <xsl:when test="$param/@Value">
- <xsl:value-of select="$param/@Value"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$param/@Default"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
- <!-- This file was formated by XML Formatter (Cognos Inc.) on Aug 17, 2005 2:56:27 PM -->
|