123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655 |
- <?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.
- -->
- <!--
- 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:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/"
- xmlns:req-params="http://developer.cognos.com/schemas/request/params"
- xmlns:out="dummy-uri"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
- exclude-result-prefixes="xsl xts dlgctrl pf req-params df">
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- =================================================================================================================================
- Will automaticaly add the global 'current-stack' hidden variable for blocks that use the processResponse template
- ====================================================================================================================================
- -->
- <xsl:template match="xsl:stylesheet[//*[local-name()='processXTS2Response']]">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
-
- <xsl:variable name="stackName" select="concat('request_stack_',descendant::*[local-name()='stackName' and namespace-uri()='http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/'])"/>
- <out:variable name="ctrl-template-current-stack">
- <out:variable name="passport">
- <out:choose>
- <out:when test="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']">
- <out:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
- </out:when>
- <out:otherwise>
- <out:variable name="cam_cookie" select="/root/cookies/cookie[@name='cam_passport']"/>
- <out:value-of select="xtsext:camcookie_action('getPassportID', $cam_cookie)"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="env-markup">
- <out:call-template name="serialize-xml">
- <out:with-param name="node-set" select="/root/env/param[@name!='m' and not(starts-with(@name,'request_stack_')) and @name!='controller_state']"/>
- </out:call-template>
- </out:variable>
-
- <out:choose>
- <out:when test="not(/root/env/param[@name='{$stackName}'])">
- <out:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode(string($env-markup), true()))"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="/root/env/param[@name='{$stackName}']"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
-
- <xsl:apply-templates/>
- <pf:serialize-xml/>
- </xsl:copy>
- </xsl:template>
- <!--
- =================================================================================================================================
- dlgctrl:XTS2Request - sends a xts:request to another morphlet
-
- /root/env, /root/http, /root/system and /root/session must be present in the DOM for dlgctrl:XTS2Request
- Input parameter Description required
- ___________________________ ___________________________________________________________ ____________________________
- <dlgctrl:target> morphlet to be called yes
- <dlgctrl:stackName> unique name to get appended to 'request_stack_' and used as yes
- <dlgctrl:resultLocation> xpath to where the result should be appended no, default is /root
- <dlgctrl:resultNode> parent node of the response no, default is <morphletResponse>
-
- <req-params:param name=""> specific input parameters for the morphlet getting called no, view documentation for
- morphlet getting called
- ====================================================================================================================================
- -->
- <xsl:template match="dlgctrl:XTS2Request">
- <!-- current controller_state -->
- <out:variable name="ctrl-template-controller-state">
- <xsl:choose>
- <xsl:when test="dlgctrl:requestState != ''">
- <xsl:value-of select="dlgctrl:requestState"/>
- </xsl:when>
- <xsl:otherwise>
- <out:choose>
- <out:when test="not(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'])">
- <out:value-of select="/root/env/param[@name='controller_state']"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState']"/>
- </out:otherwise>
- </out:choose>
- </xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <!-- state that will be sent in the request. -->
- <out:variable name="ctrl-template-new-state">
- <out:value-of select="substring-after($ctrl-template-controller-state,'|')"/>
- </out:variable>
-
- <!-- where should the result be appended to -->
- <xsl:variable name="resultLocation">
- <xsl:choose>
- <xsl:when test="./*[local-name()='resultLocation'] != ''">
- <xsl:value-of select="./*[local-name()='resultLocation']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'/root'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- what node name should we use as the parent of the response -->
- <xsl:variable name="resultNode">
- <xsl:choose>
- <xsl:when test="./*[local-name()='resultNode'] != ''">
- <xsl:value-of select="./*[local-name()='resultNode']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'morphletResponse'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="stackName" select="concat('request_stack_',./*[local-name()='stackName'])"/>
-
- <!-- Call the morphlet -->
- <xts:append select="{$resultLocation}">
- <xts:request name="BUS" target="bus://xts2{./*[local-name()='target']}" option="xml" outputHeader="true">
- <req-params:requestParams>
- <req-params:param name="requestState"><out:value-of select="$ctrl-template-new-state"/></req-params:param>
- <req-params:param name="resultNode"><xsl:value-of select="$resultNode"/></req-params:param>
- <!-- copy all the params that were passes in -->
- <xsl:copy-of select="./*[local-name()='param']"/>
- </req-params:requestParams>
-
- <!-- env -->
- <xts:queryNode select="/root/env | /root/http | /root/session | /root/credential | /root/cookies | /root/header | /root/user "/>
- </xts:request>
- </xts:append>
- </xsl:template>
-
- <!--
- =================================================================================================================================
- dlgctrl:processXTS2Response - Process the response returned from dlgctrl:XTS2Request
- Input parameter Description required
- ___________________________ ___________________________________________________________ ____________________________
- <dlgctrl:stackName> unique name to get appended to 'request_stack_' and used as yes
- an element name to contain the current stack
-
- <dlgctrl:resultLocation> xpath to where the result should be appended no, default is /root
-
- <dlgctrl:resultNode> parent node of the response no, default is <morphletResponse>
-
- <dlgctrl:mode match=""> Section to be used if the root element of the response no, only need for post processing
- matches the attribute 'match' of the result
-
- Any descendant of <dlgctrl:mode match=""> which has the dlgctrl namespace will get changed to use the xts namespace. <dlgctrl:morphletResponse/> will
- get replaced by the response.
- ====================================================================================================================================
- -->
- <xsl:template match="dlgctrl:processXTS2Response">
- <xsl:variable name="stackName" select="concat('request_stack_',./*[local-name()='stackName'])"/>
-
- <!-- what's the parent node of the response -->
- <xsl:variable name="resultNode">
- <xsl:choose>
- <xsl:when test="./*[local-name()='resultNode']!=''">
- <xsl:value-of select="./*[local-name()='resultNode']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'morphletResponse'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- where was the response appeneded in the DOM -->
- <xsl:variable name="resultLocation">
- <xsl:choose>
- <xsl:when test="./*[local-name()='resultLocation'] != ''">
- <xsl:value-of select="concat(./*[local-name()='resultLocation'],'/*[local-name()="',$resultNode,'"]')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('/root/*[local-name()="',$resultNode,'"]')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <out:choose>
- <!-- append any markup that was returned to the output spec -->
- <out:when test="local-name({$resultLocation}/*) = 'markup'">
- <out:choose>
- <!-- if there's no request state then we're not a nested request, so process the returned markup -->
- <out:when test="not(/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'])">
- <xsl:apply-templates select="*[@match='markup' and local-name()='mode' and namespace-uri()='http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/']/*" mode="processResponse">
- <xsl:with-param name="resultLocation" select="string($resultLocation)"/>
- <xsl:with-param name="stackName" select="string($stackName)"/>
- <xsl:with-param name="resultNode" select="string($resultNode)"/>
- </xsl:apply-templates>
- </out:when>
- <!-- if there's a request state, then it means that this is a nested request.
- Add the current stack and send back the markup -->
- <out:otherwise>
- <xts:append select="/root/output">
- <xts:transform name="Null" option="part" mimeType="text/html">
- <xsl:element name="{$resultNode}" namespace="">
- <markup>
- <out:value-of select="{$resultLocation}/*[local-name()='markup']"/>
- <xts:transform name="XMLEncode">
- <input type="hidden" name="{$stackName}">
- <out:attribute name="value">
- <out:value-of select="$ctrl-template-current-stack"/>
- </out:attribute>
- </input>
- </xts:transform>
- </markup>
- <out:copy-of select="{$resultLocation}/*[local-name() != 'markup']"/>
- </xsl:element>
- </xts:transform>
- </xts:append>
- </out:otherwise>
- </out:choose>
- </out:when>
-
- <!-- the response isn't markup, so process it -->
- <out:otherwise>
- <out:variable name="xml-encoded-stack" select="xtsext:web64decode( xtsext:cafaction( 'sign_unwrap', string( $ctrl-template-current-stack )), true())"/>
- <!-- we've gotten a response, so remove the requested morphlet and action from the controller state -->
- <out:variable name="ctrl-template-controller-state">
- <out:value-of select="xtsext:substringBeforeLast(string( xtsext:substringBeforeLast(string(/root/env/param[@name='controller_state']), '|') ), '|')"/>
- </out:variable>
- <xts:delete select="/root/env/param[@name != 'm' and (not(starts-with(@name,'request_stack_')) or @name= '{$stackName}')]"/>
-
- <!-- unpack the stack -->
- <out:if test="$xml-encoded-stack != ''">
- <xts:append select="/root/env">
- <xts:transform name="XMLDecode">
- <out:value-of select="$xml-encoded-stack"/>
- </xts:transform>
- </xts:append>
- </out:if>
- <!-- if the controller state isn't empty then we must be in a nested request. Switch the action to markup
- to allow the current morphlet to produce the proper markup with the results just received -->
- <out:if test="$ctrl-template-controller-state != ''">
- <xts:append select="/root/env">
- <param name="controller_state">
- <out:value-of select="concat($ctrl-template-controller-state, '|markup')"/>
- </param>
- </xts:append>
- </out:if>
-
- <xsl:for-each select="*[local-name()='mode' and @match!='markup' and namespace-uri()='http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/']">
- <out:if test="{$resultLocation}/*[local-name()='{@match}']">
- <!-- check to see if the results should get processed -->
- <xsl:apply-templates select="./*" mode="processResponse">
- <xsl:with-param name="resultLocation" select="string($resultLocation)"/>
- <xsl:with-param name="stackName" select="string($stackName)"/>
- <xsl:with-param name="resultNode" select="string($resultNode)"/>
- <xsl:with-param name="match" select="@match"/>
- </xsl:apply-templates>
- </out:if>
- </xsl:for-each>
- </out:otherwise>
- </out:choose>
- </xsl:template>
- <!--
- ====================================================================================================================================
- Take <dlgctrl:morphletResponse> and replace it with the response returned from the request. If we're dealing with markup then
- also append the appropriate stack information
- ====================================================================================================================================
- -->
- <xsl:template match="*[local-name()='morphletResponse' and namespace-uri()='http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/']" mode="processResponse" priority="2">
- <xsl:param name="resultLocation"/>
- <xsl:param name="stackName"/>
- <xsl:param name="resultNode"/>
- <xsl:param name="match"/>
- <out:choose>
- <!-- special case if the response is markup -->
- <out:when test="local-name({$resultLocation}/*) = 'markup'">
- <xsl:element name="{$resultNode}">
- <markup>
- <out:value-of select="{$resultLocation}/*[local-name()='markup']"/>
- <xts:transform name="XMLEncode">
- <input type="hidden" name="{$stackName}">
- <out:attribute name="value">
- <out:value-of select="$ctrl-template-current-stack"/>
- </out:attribute>
- </input>
- </xts:transform>
- </markup>
- <out:copy-of select="{$resultLocation}/*[local-name() != 'markup']"/>
- </xsl:element>
- </out:when>
- <out:otherwise>
- <out:copy-of select="{$resultLocation}/*[local-name()='{$match}']"/>
- </out:otherwise>
- </out:choose>
- </xsl:template>
- <!--
- ====================================================================================================================================
- Simply copy any element that under <dlgctrl:mode match=""> that doesn't have the dlgctrl namespace
- ====================================================================================================================================
- -->
- <xsl:template match="*" mode="processResponse" priority="0">
- <xsl:param name="resultLocation"/>
- <xsl:param name="stackName"/>
- <xsl:param name="resultNode"/>
- <xsl:param name="match"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="processResponse">
- <xsl:with-param name="resultLocation" select="$resultLocation"/>
- <xsl:with-param name="stackName" select="$stackName"/>
- <xsl:with-param name="resultNode" select="$resultNode"/>
- <xsl:with-param name="match" select="$match"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:template>
-
- <!--
- ===============================================================================================
- dlgctrl:markupHelper
- same hidden inputs and javascript in each morphlet that uses the controller architecture
- ===============================================================================================
- -->
- <xsl:template match="dlgctrl:markupHelper">
- <input type="hidden" name="controller_state" value="{'{/root/env/param[@name="controller_state"]}'}"/>
- <out:variable name="ctrl-template-controller-state" select="xtsext:javascriptencode(string(xtsext:substringBeforeLast(string(/root/env/param[@name='controller_state']), '|')))"/>
- <out:variable name="ctrl-template-formName">
- <out:choose>
- <out:when test="/root/*[local-name()='requestParams']/*[local-name()='param'][@name='formName'] != ''">
- <out:value-of select="/root/*[local-name()='requestParams']/*[local-name()='param'][@name='formName']"/>
- </out:when>
- <out:otherwise>
- <xsl:value-of select="'pform'"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
-
- <out:variable name="ctrl-template-targetDefault" select="/root/*[local-name()='requestParams']/*[local-name()='param'][@name='defaultTarget']"/>
- <out:variable name="ctrl-template-requestParams" select="/root/*[local-name()='requestParams']/*[local-name()='param']"/>
-
- <script language="javascript">
- function controller_doSubmit(callMorph, morphState, navOp)
- {
- frm = document.<out:value-of select="$ctrl-template-formName"/>;
- frm.controller_state.value = '<out:value-of select="xtsext:javascriptencode($ctrl-template-controller-state)"/>';
-
- if (callMorph != '')
- {
- frm.controller_state.value += '|' + callMorph;
- }
- if (morphState != '')
- {
- frm.controller_state.value += '|' + morphState;
- }
-
- controller_submitForm('default');
- }
-
- function controller_changeState(newState)
- {
- frm = document.<out:value-of select="$ctrl-template-formName"/>;
- frm.controller_state.value = '<out:value-of select="xtsext:javascriptencode($ctrl-template-controller-state)"/>';
- frm.controller_state.value += '|' + newState;
- }
-
- function controller_setTarget(target)
- {
- if (target != '')
- {
- document.<out:value-of select="$ctrl-template-formName"/>.target = target;
- }
- }
-
- function controller_submitForm(action)
- {
- frm = document.<out:value-of select="$ctrl-template-formName"/>;
-
- <out:choose>
- <!-- wizard buttons -->
- <out:when test="$ctrl-template-requestParams[@name='inWizard'] = 'true'">
- <!-- back -->
- if (action == 'back')
- {
- <xsl:call-template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:with-param name="button" select="'backTarget'"/>
- </xsl:call-template>
- }
- <!-- next -->
- if (action == 'next')
- {
- <xsl:call-template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:with-param name="button" select="'nextTarget'"/>
- </xsl:call-template>
- }
- <!-- finish -->
- if (action == 'finish')
- {
- <out:if test="$ctrl-template-requestParams[@name='agentStudio'] = 'true'">
- <!-- Event Studio specific javascript -->
- if (window.getConfigFrame)
- {
- var cf = getConfigFrame();
- if (cf != null)
- {
- cf.cfgSet("agentHasChanged", true);
- }
- }
- </out:if>
- <xsl:call-template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:with-param name="button" select="'finishTarget'"/>
- </xsl:call-template>
- }
- </out:when>
- <!-- ok button -->
- <out:otherwise>
- if (action == 'ok')
- {
- <xsl:call-template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:with-param name="button" select="'okTarget'"/>
- </xsl:call-template>
- }
- </out:otherwise>
- </out:choose>
- <!-- cancel -->
- if (action == 'cancel')
- {
- <out:choose>
- <out:when test="$ctrl-template-requestParams[@name='fromFM']='true'">
- window.external.OnClose(1);
- </out:when>
- <out:otherwise>
- <xsl:call-template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:with-param name="button" select="'cancelTarget'"/>
- </xsl:call-template>
- </out:otherwise>
- </out:choose>
- }
- <!-- default action -->
- if (action == 'default' || action == '')
- {
- <xsl:call-template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:with-param name="button" select="'defaultTarget'"/>
- </xsl:call-template>
- }
-
- frm.submit();
- }
- </script>
- </xsl:template>
-
- <!--
- ===============================================================================================
- dlgctrl:buttonSubmitJavaScript
- generate the javascript for the buttons
- ===============================================================================================
- -->
- <!-- generate the javascript for the buttons -->
- <xsl:template name="dlgctrl:buttonSubmitJavaScript">
- <xsl:param name="button"/>
-
- <out:choose>
- <out:when test="$ctrl-template-requestParams[@name='{$button}'] = 'disable'"/>
- <out:when test="$ctrl-template-requestParams[@name='{$button}'] != ''">
- frm.m.value = '<out:value-of select="xtsext:javascriptencode(string($ctrl-template-requestParams[@name="{$button}"]))"/>';
- </out:when>
- <out:otherwise>
- frm.m.value = '<out:value-of select="xtsext:javascriptencode(string(/root/*[local-name()='requestParams']/*[local-name()='param'][@name='defaultTarget']))"/>';
- </out:otherwise>
- </out:choose>
- </xsl:template>
-
- <!--
- ===============================================================================================
- dlgctrl:wizardButtons
- Add the wizard buttons (cancel, back, next and finish)
- ===============================================================================================
- -->
- <xsl:template match="dlgctrl:wizardButtons">
- <out:variable name="wizardButtons-requestParams" select="/root/*[local-name()='requestParams']/*[local-name()='param']"/>
- <xsl:call-template name="dlgctrl:genButton">
- <xsl:with-param name="button" select="'cancel'"/>
- <xsl:with-param name="newState" select="'canceled'"/>
- <xsl:with-param name="buttonText" select="'IDS_CANCEL'"/>
- </xsl:call-template>
- <xsl:call-template name="dlgctrl:genButton">
- <xsl:with-param name="button" select="'back'"/>
- <xsl:with-param name="newState" select="'back'"/>
- <xsl:with-param name="buttonText" select="'IDS_BACK'"/>
- <xsl:with-param name="validateFunction" select="@validateFunction"/>
- </xsl:call-template>
- <xsl:call-template name="dlgctrl:genButton">
- <xsl:with-param name="button" select="'next'"/>
- <xsl:with-param name="newState" select="'next'"/>
- <xsl:with-param name="buttonText" select="'IDS_NEXT'"/>
- <xsl:with-param name="validateFunction" select="@validateFunction"/>
- </xsl:call-template>
- <xsl:call-template name="dlgctrl:genButton">
- <xsl:with-param name="button" select="'finish'"/>
- <xsl:with-param name="newState" select="'finished'"/>
- <xsl:with-param name="buttonText" select="'IDS_FINISH'"/>
- <xsl:with-param name="validateFunction" select="@validateFunction"/>
- </xsl:call-template>
- </xsl:template>
- <!--
- ===============================================================================================
- dlgctrl:okCancelButtons
- Add the ok cancel buttons
- ===============================================================================================
- -->
- <xsl:template match="dlgctrl:okCancelButtons">
- <out:variable name="wizardButtons-requestParams" select="/root/*[local-name()='requestParams']/*[local-name()='param']"/>
- <xsl:call-template name="dlgctrl:genButton">
- <xsl:with-param name="button" select="'ok'"/>
- <xsl:with-param name="newState" select="'finished'"/>
- <xsl:with-param name="buttonText" select="'IDS_OK'"/>
- <xsl:with-param name="validateFunction" select="@validateFunction"/>
- </xsl:call-template>
- <xsl:call-template name="dlgctrl:genButton">
- <xsl:with-param name="button" select="'cancel'"/>
- <xsl:with-param name="newState" select="'canceled'"/>
- <xsl:with-param name="buttonText" select="'IDS_CANCEL'"/>
- </xsl:call-template>
- </xsl:template>
- <!--
- ===============================================================================================
- dlgctrl:genButton
- generate a button
- ===============================================================================================
- -->
- <xsl:template name="dlgctrl:genButton">
- <xsl:param name="button"/>
- <xsl:param name="newState"/>
- <xsl:param name="buttonText"/>
- <xsl:param name="validateFunction" select="''"/>
- <out:choose>
- <out:when test="$wizardButtons-requestParams[@name='{concat($button,'Target')}'] = 'disable'">
- <df:button df:id="{$buttonText}"/>
- </out:when>
- <out:when test="$wizardButtons-requestParams[@name='{concat($button,'URL')}'] and $wizardButtons-requestParams[@name='{concat($button,'URL')}'] != ''">
- <out:variable name="target">
- <out:choose>
- <out:when test="$wizardButtons-requestParams[@name='{concat($button,'URL')}' and @target != '']">
- <out:value-of select="$wizardButtons-requestParams[@name='{concat($button,'URL')}']/@target"/>
- </out:when>
- <out:otherwise>
- <xsl:value-of select="'_self'"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="URLButton">
- <out:value-of select="xtsext:javascriptencode(string($wizardButtons-requestParams[@name="{concat($button,'URL')}"]))"/>
- </out:variable>
- <script language="javascript">
- function submitButton_<xsl:value-of select="$button"/>()
- {
- <!-- always set the target to _top for the buttons in the footer -->
- <out:if test="$wizardButtons-requestParams[@name='isPopup'] = 'true'">
- document.<out:value-of select="$ctrl-template-formName"/>.target = '_parent';
- </out:if>
- <xsl:choose>
- <xsl:when test="$validateFunction != ''">
- if ( (window.<xsl:value-of select="$validateFunction"/> && <xsl:value-of select="$validateFunction"/>()) || !window.<xsl:value-of select="$validateFunction"/> )
- {
- document.location.href = "<out:value-of select="$URLButton"/>";
- }
- </xsl:when>
- <xsl:otherwise>
- document.location.href = "<out:value-of select="$URLButton"/>";
- </xsl:otherwise>
- </xsl:choose>
- }
- </script>
- <df:button df:id="{$buttonText}" df:style="href" onclick="submitButton_{$button}();" df:href="#" target="{'{$target}'}"/>
- </out:when>
- <out:otherwise>
- <script language="javascript">
- function submitButton_<xsl:value-of select="$button"/>()
- {
- <xsl:choose>
- <xsl:when test="$validateFunction != ''">
- if ( (window.<xsl:value-of select="$validateFunction"/> && <xsl:value-of select="$validateFunction"/>()) || !window.<xsl:value-of select="$validateFunction"/> )
- {
- <!-- always set the target to _top for the buttons in the footer -->
- <out:if test="$wizardButtons-requestParams[@name='isPopup'] = 'true'">
- document.<out:value-of select="$ctrl-template-formName"/>.target = '_parent';
- </out:if>
- controller_changeState('<xsl:value-of select="$newState"/>');
- controller_submitForm('<xsl:value-of select="$button"/>');
- }
- </xsl:when>
- <xsl:otherwise>
- <!-- always set the target to _top for the buttons in the footer -->
- <out:if test="$wizardButtons-requestParams[@name='isPopup'] = 'true'">
- document.<out:value-of select="$ctrl-template-formName"/>.target = '_parent';
- </out:if>
- controller_changeState('<xsl:value-of select="$newState"/>');
- controller_submitForm('<xsl:value-of select="$button"/>');
- </xsl:otherwise>
- </xsl:choose>
- }
- </script>
- <df:button df:id="{$buttonText}" df:style="href" df:href="#" onclick="submitButton_{$button}();"/>
- </out:otherwise>
- </out:choose>
- </xsl:template>
-
-
-
- <!-- the main engine -->
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|