123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ASV
- (C) Copyright IBM Corp. 2005, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml,messages/portalRL.xml,messages/subscribe.xml" resolverBase="prompting" includeConfig="true">
- <!--
- ===============================================================================================
- processRequestParams - Default any params that weren't passed in. Also this is where we would
- do validation (when time permits).
- ===============================================================================================
- -->
- <xts:block id="processRequestParams" processor="XSLT" type="exec" nodeList="/root/*[local-name()='requestParams']">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/*[local-name()='requestParams']">
- <xts:transform src="portal/controls/gen_default_parameters.xslt" processor="XSLT">
- <root>
- <xts:transform name="XML">
- <xts:param name="systemId">subscribe/setLabels/setLabels_interface.xml</xts:param>
- </xts:transform>
- <xsl:copy-of select="/root/*[local-name()='requestParams']"/>
- </root>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- returnResult - We're done with the email options morphlet, so return the appropriate response
- ===============================================================================================
- -->
- <xts:block id="returnResult" type="exec" processor="XSLT" dependency="processRequestParams" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished' or /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'canceled']" mandatory="false">
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xsl xos xtsext">
- <xsl:output method="xml" encoding="utf-8" indent="no"/>
- <xsl:key name="env-param" match="/root/env/param" use="@name"/>
- <xsl:key name="system-param" match="/root/system/param" use="@name"/>
- <xsl:key name="session-param" match="/root/session/param" use="@name"/>
- <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/output">
- <!-- build a part -->
- <xts:transform name="Null" option="part" mimeType="text/xml">
- <xsl:element name="{key('request-param','resultNode')}" namespace="">
- <xsl:choose>
- <xsl:when test="key('request-param','requestState') = 'canceled'">
- <canceled/>
- </xsl:when>
- <xsl:otherwise>
- <setLabels>
- <xsl:choose>
- <xsl:when test="key('env-param','owner_action')='approve'">
- <param name="m_ro_approveValue">
- <xsl:value-of select="key('env-param','approveText')"/>
- </param>
- <param name="m_ro_rejectValue">
- <xsl:value-of select="key('env-param','rejectText')"/>
- </param>
- </xsl:when>
- <xsl:when test="key('env-param','owner_action')='agent'">
- <param name="m_ro_submitValue">
- <xsl:value-of select="key('env-param','submitText')"/>
- </param>
- <xsl:copy-of select="/root/env/param[starts-with(@name, 'm_ro_agentTaskItem_')]"/>
- </xsl:when>
- </xsl:choose>
- </setLabels>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- HTML output
- ===============================================================================================
- -->
- <xts:block id="genMarkup" type="exec" processor="XSLT" dependency="processRequestParams" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup'] " mandatory="false">
- <!-- logicsheets -->
- <!-- portal specific information -->
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <!-- Dialog specific logicsheets -->
- <xts:logicsheet path="subscribe/taskOptions/logicsheets/ui-templates.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
- <!-- Generic logicsheets -->
- <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
- <xts:logicsheet path="logicsheets/validation.xslt"/>
- <xts:logicsheet path="logicsheets/formlogic.xslt"/>
- <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:eut="http://developer.cognos.com/schemas/xts/logicsheets/xslt/emailOptions/logicsheets/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" exclude-result-prefixes="xts xsl cm pf xtsext lyt dp df cf cp xos dlgctrl eut utml">
- <xsl:output method="xml" encoding="utf-8" indent="no"/>
- <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
- <!-- Global template variables -->
- <pf:variables/>
- <dp:variables/>
- <!-- set up some variables -->
- <xsl:variable name="browserTitle">
- <xts:string id="IDS_SETLABEL_TITLE"/>
- </xsl:variable>
- <xsl:variable name="description">
- <xts:string id="IDS_SETLABEL_DESCRIPTION"/>
- </xsl:variable>
- <!-- start the output -->
- <xsl:template match="/root">
- <xts:sequence>
- <xts:append select="/root/output">
- <xos:part>
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <xsl:element name="{key('request-param','resultNode')}" namespace="">
- <markup>
- <xts:transform name="XMLEncode">
- <!-- adds standard hidden inputs and javascript -->
- <dlgctrl:markupHelper/>
- <dp:header div="div">
- <dp:title>
- <xsl:value-of select="$browserTitle"/>
- </dp:title>
- <dp:description>
- <xsl:value-of select="$description"/>
- </dp:description>
- <dp:close>
- <a href="#">
- <xsl:attribute name="onclick">
- <xsl:if test="key('request-param','isPopup')='true'">document.pform.target='_parent';</xsl:if>
- controller_changeState('canceled'); controller_submitForm('cancel');
- </xsl:attribute>
- <dp:closeMarker/>
- </a>
- </dp:close>
- <dp:useDIVS>
- <xsl:text>false</xsl:text>
- </dp:useDIVS>
- </dp:header>
- <pf:help context=""/>
- <script language="javascript">
- function init()
- {
- //nothing here yet
- }
-
- function validate()
- {
- <xsl:choose>
- <xsl:when test="key('request-param','owner_action')='approve'">
- <!-- have to make sure that approve/reject are not empty and they're unique -->
- var approveText = document.getElementById('approveText').value;
- var rejectText = document.getElementById('rejectText').value;
- if (approveText.length == 0) {
- alert('<xts:string id="IDS_SETLABEL_NOAPPROVE_TEXT" encode="javascript"/>');
- return false;
- }
- if (rejectText.length == 0) {
- alert('<xts:string id="IDS_SETLABEL_NOREJECT_TEXT" encode="javascript"/>');
- return false;
- }
- if (approveText == rejectText) {
- alert('<xts:string id="IDS_SETLABEL_APPROVE_REJECT_SAME" encode="javascript"/>');
- return false;
- }
- return true;
- </xsl:when>
- <xsl:when test="key('request-param','owner_action')='agent'">
- <!-- have to make sure that all the labels are not empty and they're unique -->
- var submitText = document.getElementById('submitText').value;
- if (submitText.length == 0) {
- alert('<xts:string id="IDS_SETLABEL_NOSUBMIT_TEXT" encode="javascript"/>');
- return false;
- }
- // have to keep all the values for the task labels
- var agentTaskArray = new Array();
- var value = "";
- <xsl:for-each select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='futureTasks']/futureTasks/futureTask">
- value = document.getElementById('<xsl:value-of select="concat('m_ro_agentTaskItem_display_', ./id)"/>').value;
- agentTaskArray.push(value);
- </xsl:for-each>
- <!-- make sure all the values are not empty -->
- if (empty(agentTaskArray)) {
- alert('<xts:string id="IDS_SETLABEL_NOTASK_TEXT" encode="javascript"/>');
- return false;
- }
- <!-- make sure they're all unique -->
- if (notUnique(agentTaskArray)) {
- alert('<xts:string id="IDS_SETLABEL_AGENTTASK_SAME" encode="javascript"/>');
- return false;
- }
- return true;
- </xsl:when>
- </xsl:choose>
- }
-
- function empty(agentTaskArray)
- {
- for (var i = 0; i < agentTaskArray.length; i++) {
- if (agentTaskArray[i].length == 0) {
- return true;
- }
- }
- return false;
- }
-
- function notUnique(agentTaskArray)
- {
- for (var i = 0; i < agentTaskArray.length; i++) {
- for (var j = i+1; j < agentTaskArray.length; j++) {
- if (agentTaskArray[i] == agentTaskArray[j]) {
- return true;
- }
- }
- }
- return false;
- }
-
- </script>
- <!-- body -->
- <lyt:layout style="1">
- <lyt:section width="100%">
- <input type="hidden" name="owner_action" value="{key('request-param','owner_action')}"/>
- <xsl:choose>
- <xsl:when test="key('request-param','owner_action')='approve'">
- <dp:list>
- <dp:section>
- <dp:hint wrap="wrap">
- <xts:string id="IDS_SETLABEL_APPROVAL_HINT"/>
- </dp:hint>
- </dp:section>
- <dp:section>
- <!-- The approval button value -->
- <input type="text" id="approveText" name="approveText" value="{key('request-param', 'approveText')}"/>
- </dp:section>
- <dp:section>
- <dp:hint wrap="wrap">
- <xts:string id="IDS_SETLABEL_REJECT_HINT"/>
- </dp:hint>
- </dp:section>
- <dp:section>
- <!-- The reject button value -->
- <input type="text" id="rejectText" name="rejectText" value="{key('request-param', 'rejectText')}"/>
- </dp:section>
- </dp:list>
- </xsl:when>
- <xsl:when test="key('request-param','owner_action')='agent'">
- <!-- body -->
- <dp:list>
- <dp:section>
- <dp:hint wrap="wrap">
- <xts:string id="IDS_SETLABEL_AGENTSUBMIT_HINT"/>
- </dp:hint>
- </dp:section>
- <dp:section>
- <!-- The approval button value -->
- <input type="text" id="submitText" name="submitText" value="{key('request-param', 'submitText')}"/>
- </dp:section>
- <dp:section>
- <dp:hint wrap="wrap">
- <xsl:if test="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='futureTasks']/futureTasks/futureTask">
- <xts:string id="IDS_SETLABEL_AGENTTASKS_HINT"/>
- </xsl:if>
- </dp:hint>
- </dp:section>
- <dp:section>
- <table cellspacing="0" cellpadding="0">
- <xsl:for-each select="/root/*[local-name()='requestParams']/*[local-name()='param' and @name='futureTasks']/futureTasks/futureTask">
- <xsl:variable name="displayID">
- <xsl:value-of select="concat('m_ro_agentTaskItem_display_', ./id)"/>
- </xsl:variable>
- <tr>
- <!-- we need a checkbox to say if the task is to be used -->
- <td>
- <input name="{$displayID}" id="{$displayID}" type="text" value="{./display}" size="80"/>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </dp:section>
- </dp:list>
- </xsl:when>
- </xsl:choose>
- </lyt:section>
- </lyt:layout>
- <dp:footer>
- <dlgctrl:okCancelButtons validateFunction="validate"/>
- </dp:footer>
- </xts:transform>
- </markup>
- </xsl:element>
- </xos:entityBody>
- </xos:part>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- debug - display debug information
- ===============================================================================================
- -->
- <xts:block id="debug" dependency="genMarkup" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
- <!-- get the debug logic sheet -->
- <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <dbg:dumpxml select="/root"/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|