postURL.xts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  13. <!-- formlogic_init =============================================================================================== -->
  14. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
  15. <xts:block id="postURL" type="exec" mode="output" processor="XSLT" dependency="formlogic_init" mimeType="text/html" contentId="head" partId="1" condition=".[/root/env/param[@name='doPostURL'] and /root/env/param[@name='doPostURL']!='']" mandatory="false">
  16. <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:xts="http://developer.cognos.com/schemas/xts/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xsl xtsext xos xts xsd xsi">
  17. <xsl:output method="html" encoding="utf-8" indent="no"/>
  18. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  19. <xsl:template match="/">
  20. <xsl:variable name="paramName" select="key('env-param','doPostURL')"/>
  21. <xsl:variable name="xurl" select="string(key('env-param', $paramName))"/>
  22. <xsl:variable name="action">
  23. <xsl:choose>
  24. <xsl:when test="contains($xurl, '?')"><xsl:value-of select="substring-before($xurl, '?')"/></xsl:when>
  25. <xsl:otherwise><xsl:value-of select="$xurl"/></xsl:otherwise>
  26. </xsl:choose>
  27. </xsl:variable>
  28. <xsl:variable name="arguments" select="substring-after($xurl, '?')"/>
  29. <html>
  30. <head>
  31. <script language="javascript">
  32. function submitForm()
  33. {
  34. <xsl:choose>
  35. <xsl:when test="($xurl = 'javascript:window.close();') or ($action='' and $arguments='')">
  36. window.close();
  37. </xsl:when>
  38. <xsl:otherwise>
  39. document.pform.submit();
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. }
  43. </script>
  44. </head>
  45. <body onload="submitForm();">
  46. <form name="pform" method="post">
  47. <xsl:attribute name="action"><xsl:value-of select="$action"/></xsl:attribute>
  48. <xsl:call-template name="buildForm">
  49. <xsl:with-param name="arguments">
  50. <xsl:value-of select="$arguments"/>
  51. </xsl:with-param>
  52. </xsl:call-template>
  53. </form>
  54. </body>
  55. </html>
  56. </xsl:template>
  57. <xsl:template name="buildForm">
  58. <xsl:param name="arguments" select="''"/>
  59. <input type="hidden">
  60. <xsl:variable name="name">
  61. <xsl:value-of select="string(xtsext:urldecode(substring-before($arguments, '=')))"/>
  62. </xsl:variable>
  63. <xsl:variable name="argumentsLessName">
  64. <xsl:value-of select="substring-after($arguments, '=')"/>
  65. </xsl:variable>
  66. <xsl:choose>
  67. <xsl:when test="contains($argumentsLessName, '&amp;')">
  68. <xsl:variable name="value">
  69. <xsl:value-of select="string(xtsext:urldecode(substring-before($argumentsLessName, '&amp;')))"/>
  70. </xsl:variable>
  71. <xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
  72. <xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute>
  73. </xsl:when>
  74. <xsl:otherwise>
  75. <xsl:variable name="value">
  76. <xsl:value-of select="string(xtsext:urldecode(string($argumentsLessName)))"/>
  77. </xsl:variable>
  78. <xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute>
  79. <xsl:attribute name="value"><xsl:value-of select="$value"/></xsl:attribute>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </input>
  83. <xsl:variable name="argumentsStripped">
  84. <xsl:value-of select="substring-after($arguments, '&amp;')"/>
  85. </xsl:variable>
  86. <xsl:if test="contains($arguments, '&amp;')">
  87. <xsl:call-template name="buildForm">
  88. <xsl:with-param name="arguments">
  89. <xsl:value-of select="$argumentsStripped"/>
  90. </xsl:with-param>
  91. </xsl:call-template>
  92. </xsl:if>
  93. </xsl:template>
  94. </xsl:stylesheet>
  95. </xts:block>
  96. <!--
  97. ===============================================================================================
  98. debug
  99. ===============================================================================================
  100. -->
  101. <xts:block id="debug" dependency="postURL" condition=".[ /root/session/param[@name='debug'] = '1' ]" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
  102. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  103. <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">
  104. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  105. <xsl:template match="/">
  106. <dbg:dumpxml select="/root"/>
  107. </xsl:template>
  108. </xsl:stylesheet>
  109. </xts:block>
  110. </xts:morphlet>