download.xts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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, 2013
  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. <!--
  14. Fetch the data type of the document content we are about to download. Not required for reports.
  15. Formats for document types are in the form of application/....
  16. -->
  17. <xts:block id="decodeEncodedParams" processor="XSLT" type="exec" condition=".[/root/env/param[@name='webcompress']]" mandatory="false">
  18. <xts:logicsheet path="logicsheets/portal.xsl"/>
  19. <xsl:stylesheet version="1.0"
  20. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  21. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  22. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  23. exclude-result-prefixes="xts pf xsl">
  24. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  25. <xsl:variable name="passport" select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
  26. <xsl:template match="/">
  27. <xsl:variable name="xml-encoded-struct">
  28. <xsl:if test="string( /root/env/param[@name='webStruct'])!=''">
  29. <xsl:value-of select="xtsext:web64decode( xtsext:validator('verify', 'webStruct', string( /root/env/param[@name='webStruct'])), true())"/>
  30. </xsl:if>
  31. </xsl:variable>
  32. <xts:sequence>
  33. <xts:delete select="/root/env/param[@name='webStruct' or @name='m_name' or @name='backURL' or @name='m_download_obj' or @name='m_obj' or @name='webcompress']"/>
  34. <xsl:if test="/root/env/param[@name='webcompress']='true'">
  35. <xts:append select="/root/env">
  36. <xsl:choose>
  37. <xsl:when test="$xml-encoded-struct!=''">
  38. <xts:transform name="XMLDecode">
  39. <xsl:value-of select="$xml-encoded-struct"/>
  40. </xts:transform>
  41. </xsl:when>
  42. <xsl:otherwise>
  43. <xsl:if test="string(/root/env/param[@name='m_name'])!=''">
  44. <param name="m_name">
  45. <xsl:value-of select="xtsext:web64decode(xtsext:validator('verify', 'm_name', string(/root/env/param[@name='m_name'])), true())"/>
  46. </param>
  47. </xsl:if>
  48. <xsl:if test="string(/root/env/param[@name='m_download_obj'])!=''">
  49. <param name="m_download_obj">
  50. <xsl:value-of select="xtsext:web64decode(xtsext:validator('verify', 'm_download_obj', string(/root/env/param[@name='m_download_obj'])), true())"/>
  51. </param>
  52. </xsl:if>
  53. <xsl:if test="string(/root/env/param[@name='m_obj'])!=''">
  54. <param name="m_obj">
  55. <xsl:value-of select="xtsext:web64decode(xtsext:validator('verify', 'm_obj', string(/root/env/param[@name='m_obj'])), true())"/>
  56. </param>
  57. </xsl:if>
  58. <xsl:if test="string(/root/env/param[@name='backURL'])!=''">
  59. <param name="backURL">
  60. <xsl:value-of select="xtsext:web64decode(xtsext:validator('verify', 'backURL', string(/root/env/param[@name='backURL'])), true())"/>
  61. </param>
  62. </xsl:if>
  63. </xsl:otherwise>
  64. </xsl:choose>
  65. </xts:append>
  66. </xsl:if>
  67. </xts:sequence>
  68. </xsl:template>
  69. </xsl:stylesheet>
  70. </xts:block>
  71. <xts:block
  72. id="getMIMEType"
  73. processor="XSLT"
  74. type="exec"
  75. mandatory="false"
  76. nodelist="env, header"
  77. dependency="decodeEncodedParams"
  78. condition=".[not(/root/env/param[@name='session_had_expired'])]">
  79. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  80. <xsl:stylesheet version="1.0"
  81. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  82. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  83. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  84. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  85. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  86. exclude-result-prefixes="xsl bus xts send cm">
  87. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  88. <xsl:template match="/root">
  89. <!-- Define the path the document object to be downloaded -->
  90. <xsl:variable name="path">
  91. <xsl:choose>
  92. <xsl:when test="env/param[@name='m_download_obj']">
  93. <xsl:value-of select="env/param[@name='m_download_obj']"/>
  94. </xsl:when>
  95. <xsl:otherwise>
  96. <xsl:value-of select="env/param[@name='m_obj']"/>
  97. </xsl:otherwise>
  98. </xsl:choose>
  99. </xsl:variable>
  100. <xsl:if test="$path != ''">
  101. <xts:sequence>
  102. <xts:append>
  103. <MIMEType>
  104. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  105. <send:request provider="cm">
  106. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  107. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  108. <cm:search><xsl:value-of select="$path"/></cm:search>
  109. <cm:properties>
  110. <cm:property name="dataType"/>
  111. <cm:property name="dataSize"/>
  112. </cm:properties>
  113. <cm:options schemaInfo="false"/>
  114. </cm:query>
  115. </xts:transform>
  116. </send:request>
  117. </xts:transform>
  118. </MIMEType>
  119. </xts:append>
  120. </xts:sequence>
  121. </xsl:if>
  122. </xsl:template>
  123. </xsl:stylesheet>
  124. </xts:block>
  125. <xts:block
  126. id="getContent" type="exec" mode="interpret" processor="XSLT"
  127. dependency="getMIMEType decodeEncodedParams"
  128. condition=".[not(/root/env/param[@name='session_had_expired'])]">
  129. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  130. <xts:logicsheet path="logicsheets/portal.xsl"/>
  131. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  132. <xsl:stylesheet version="1.0" xmlns:out="http://www.w3.org/1999/XSL/Transform"
  133. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  134. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  135. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  136. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  137. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  138. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  139. exclude-result-prefixes="xsl xtsext send xos cm">
  140. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  141. <pf:variables/>
  142. <xsl:template match="/root">
  143. <xsl:variable name="currentFormat" select="env/param[@name='format']"/>
  144. <!-- If we had to fetch a mime type then we must be dealling with a document object (as opposed to a report output) -->
  145. <xsl:variable name="isDocumentObj" select="/root/MIMEType//cm:documentContent"/>
  146. <xsl:variable name="noquestion" select="xtsext:replace(string(env/param[@name='m_name']),'?','_')"/>
  147. <xsl:variable name="noquote" select="xtsext:replace(string($noquestion),'&quot;','_')"/>
  148. <xsl:variable name="noast" select="xtsext:replace(string($noquote),'*','_')"/>
  149. <xsl:variable name="nolt" select="xtsext:replace(string($noast),'&lt;','_')"/>
  150. <xsl:variable name="nogt" select="xtsext:replace(string($nolt),'&gt;','_')"/>
  151. <xsl:variable name="nobs" select="xtsext:replace(string($nogt),'\','_')"/>
  152. <xsl:variable name="nofs" select="xtsext:replace(string($nobs),'/','_')"/>
  153. <xsl:variable name="nocol" select="xtsext:replace(string($nofs),':','_')"/>
  154. <xsl:variable name="nobar" select="xtsext:replace(string($nocol),'|','_')"/>
  155. <!-- Set references to lookup (config) tables for report and document objects -->
  156. <!-- Report format lookup table -->
  157. <xsl:variable name="reportFormats" select="key('system-param', 'reportFormats')"/>
  158. <!-- Document format lookup table -->
  159. <xsl:variable name="documentFormats" select="key('system-param', 'documentFormats')"/>
  160. <!-- InteractiveReport -->
  161. <xsl:variable name="isInteractiveOutput" select="starts-with(string(MIMEType/*/cm:output/cm:dataType),'message/rfc822')"/>
  162. <!-- Only set the variable when we are handling a document object -->
  163. <xsl:variable name="documentObjectDataType">
  164. <xsl:if test="$isDocumentObj">
  165. <xsl:value-of select="MIMEType/*/cm:documentContent/cm:dataType"/>
  166. </xsl:if>
  167. </xsl:variable>
  168. <!-- Only set the variable when we are handling interactive output -->
  169. <xsl:variable name="interactiveDataType">
  170. <xsl:if test="$isInteractiveOutput">
  171. <xsl:value-of select="MIMEType/*/cm:output/cm:dataType"/>
  172. </xsl:if>
  173. </xsl:variable>
  174. <xsl:variable name="downloadObjectDataSize" select="MIMEType//cm:dataSize"/>
  175. <!-- File Extension -->
  176. <!-- ============================================= -->
  177. <!-- Decide what the file extension is. -->
  178. <xsl:variable name="fileext">
  179. <xsl:choose>
  180. <!-- See if a mime/extension is defined for the data type of the documentContent object -->
  181. <xsl:when test="$isDocumentObj">
  182. <xsl:choose>
  183. <!--
  184. For document objects, the extension is strictly obtained from configuration lookup table. If it is not there then leave it empty.
  185. We have to assume that the extension is part of the CM name.
  186. -->
  187. <xsl:when test="$documentFormats/format[@id = $documentObjectDataType]/@extension">
  188. <xsl:value-of select="$documentFormats/format[@id = $documentObjectDataType]/@extension"/>
  189. </xsl:when>
  190. <!-- Get the configured extension based on the type of the document object. If none exists then leave blank. -->
  191. <xsl:otherwise>
  192. <xsl:value-of select="$documentFormats/format[@id = $currentFormat]/@extension"/>
  193. </xsl:otherwise>
  194. </xsl:choose>
  195. </xsl:when>
  196. <!-- Lookup configured file extension based on report type -->
  197. <xsl:when test="string($reportFormats/format[@id = $currentFormat]/@extension)!=''">
  198. <!-- We are dealing with a report and we have successfully found a configured extension for the given report format. -->
  199. <xsl:value-of select="$reportFormats/format[@id = $currentFormat]/@extension"/>
  200. </xsl:when>
  201. <!-- No configured extension for the given report format. Look one up in a list of hard-coded defaults. -->
  202. <xsl:otherwise>
  203. <xsl:call-template name="getDefaultFileExt">
  204. <xsl:with-param name="format" select="$currentFormat"/>
  205. <xsl:with-param name="useInteractiveExt" select="$isInteractiveOutput"/>
  206. </xsl:call-template>
  207. </xsl:otherwise>
  208. </xsl:choose>
  209. </xsl:variable>
  210. <!-- File Name -->
  211. <!-- ============================================= -->
  212. <!-- Determine if the existing cm name already ends with an extension that we are about to append on -->
  213. <xsl:variable name="cmNameLength" select="string-length($nobar)"/>
  214. <xsl:variable name="extLength" select="string-length(concat('.', $fileext))"/>
  215. <xsl:variable name="endsWithExt" select="substring($nobar, (($cmNameLength - $extLength) + 1), $extLength) = concat('.', $fileext)"/>
  216. <!-- Assemble the file name to be sent back in the http response -->
  217. <xsl:variable name="filename">
  218. <xsl:choose>
  219. <xsl:when test="$browser='ie'"><xsl:value-of select="xtsext:urlencode($nobar)"/></xsl:when>
  220. <xsl:otherwise><xsl:value-of select="$nobar"/></xsl:otherwise>
  221. </xsl:choose>
  222. <!-- Unless the CM filename has an extension already, append the appropriate extension. -->
  223. <xsl:if test="($fileext != '') and not($endsWithExt)">
  224. <xsl:value-of select="concat('.', $fileext)"/>
  225. </xsl:if>
  226. </xsl:variable>
  227. <!-- If a specific MIME type is specified then use it. -->
  228. <xsl:variable name="MIMEType">
  229. <xsl:choose>
  230. <!--
  231. If this is a document object then use the dataType stored in the documentContent as a mime - provided it is not empty.
  232. If this is interactive output then use the stored dataType - using an explicitly configured mime type may cause downloads to fail.
  233. Otherwise let it default to 'application/octet-stream' below.
  234. -->
  235. <xsl:when test="$documentObjectDataType != ''">
  236. <xsl:value-of select="$documentObjectDataType"/>
  237. </xsl:when>
  238. <!-- For report objects, see if an explicit mime type is defined in the list of enumerated reports in PS. If yes then use it. -->
  239. <xsl:when test="string($reportFormats/format[@id = $currentFormat]/@mime) != ''">
  240. <xsl:value-of select="$reportFormats/format[@id = $currentFormat]/@mime"/>
  241. </xsl:when>
  242. <xsl:when test="$interactiveDataType != ''">
  243. <xsl:value-of select="$interactiveDataType"/>
  244. </xsl:when>
  245. <!-- Special format that this download supports but is not recognized as a stand-alone object format -->
  246. <xsl:when test="$currentFormat = 'png'">
  247. <xsl:value-of select="'image/png'"/>
  248. </xsl:when>
  249. <xsl:otherwise>
  250. <xsl:value-of select="'application/octet-stream'"/>
  251. </xsl:otherwise>
  252. </xsl:choose>
  253. </xsl:variable>
  254. <xsl:variable name="objectPath">
  255. <xsl:choose>
  256. <xsl:when test="/root/env/param[@name='m_download_obj']">
  257. <xsl:value-of select="env/param[@name='m_download_obj']"/>
  258. </xsl:when>
  259. <xsl:otherwise>
  260. <xsl:value-of select="env/param[@name='m_obj']"/>
  261. </xsl:otherwise>
  262. </xsl:choose>
  263. </xsl:variable>
  264. <xsl:variable name="compress" select="boolean(contains(http/param[@name='HTTP_ACCEPT_ENCODING'], 'gzip') and $currentFormat != 'PDF')"/>
  265. <xts:sequence>
  266. <xts:append select="/root/output">
  267. <send:request provider="cm" option="xml-part">
  268. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  269. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  270. <cm:search><xsl:value-of select="$objectPath"/></cm:search>
  271. <cm:properties>
  272. <cm:property name="data"/>
  273. </cm:properties>
  274. <xsl:choose>
  275. <xsl:when test="$compress">
  276. <cm:options dataEncoding="MIMECompressed"/>
  277. </xsl:when>
  278. <xsl:otherwise>
  279. <cm:options dataEncoding="MIME"/>
  280. </xsl:otherwise>
  281. </xsl:choose>
  282. </cm:query>
  283. </xts:transform>
  284. </send:request>
  285. </xts:append>
  286. <xts:replace select="/root/output/*[local-name() = 'part']/*[local-name() = 'entityHeader']">
  287. <xos:entityHeader>
  288. <xsl:if test="$compress">
  289. <xos:param name="Content-Encoding">gzip</xos:param>
  290. </xsl:if>
  291. <xsl:choose>
  292. <xsl:when test="$isInteractiveOutput">
  293. <xsl:choose>
  294. <xsl:when test="$browser != 'ie'">
  295. <xos:param name="Cache-Control">no-cache, no-store</xos:param>
  296. <xos:param name="Pragma">no-cache</xos:param>
  297. </xsl:when>
  298. </xsl:choose>
  299. <xos:param name="Expires">Thu, 01 Jan 1970 00:00:00 GMT</xos:param>
  300. <xos:param name="Content-Type"><xsl:value-of select="$MIMEType"/></xos:param>
  301. <xos:param name="Content-Length"><xsl:value-of select="$downloadObjectDataSize"/></xos:param>
  302. <xos:param name="Content-Disposition">attachment; filename="<xsl:value-of select="string($filename)"/>"</xos:param>
  303. </xsl:when>
  304. <xsl:otherwise>
  305. <xos:param name="Content-Type"><xsl:value-of select="$MIMEType"/></xos:param>
  306. <xos:param name="Content-Disposition">attachment; filename="<xsl:value-of select="string($filename)"/>"</xos:param>
  307. </xsl:otherwise>
  308. </xsl:choose>
  309. </xos:entityHeader>
  310. </xts:replace>
  311. </xts:sequence>
  312. <!-- log to IPF -->
  313. <xts:sequence>
  314. <xts:append>
  315. <log>
  316. <xts:function name="ipflog">
  317. <xts:param name="indication">Audit.RTUsage</xts:param>
  318. <xts:param name="level">3</xts:param>
  319. <xts:param name="logData">&lt;param&gt;<xsl:value-of select="xtsext:xmlencode(string(key('env-param', 'm_name')))"/>&lt;/param&gt;</xts:param>
  320. <xts:param name="operation">VIEW</xts:param>
  321. <xts:param name="objectPath"><xsl:value-of select="key('env-param', 'm_obj')"/></xts:param>
  322. <xts:param name="objectType">
  323. <xsl:choose>
  324. <xsl:when test="contains(key('env-param', 'm_obj'), 'reportView')">REPORTVIEW</xsl:when>
  325. <xsl:when test="contains(key('env-param', 'm_obj'), 'query')">QUERY</xsl:when>
  326. <xsl:when test="key('env-param', 'm_class') = 'document'">COCDOCUMENT</xsl:when>
  327. <xsl:otherwise>REPORT</xsl:otherwise>
  328. </xsl:choose>
  329. </xts:param>
  330. <xts:param name="status">Success</xts:param>
  331. </xts:function>
  332. </log>
  333. </xts:append>
  334. </xts:sequence>
  335. </xsl:template>
  336. <!-- Default file extensions in case the ones in the -->
  337. <xsl:template name="getDefaultFileExt">
  338. <xsl:param name="format"/>
  339. <xsl:param name="useInteractiveExt" select="false()"/>
  340. <xsl:choose>
  341. <xsl:when test="$format = 'CSV'">csv</xsl:when>
  342. <xsl:when test="$format = 'PDF'">pdf</xsl:when>
  343. <xsl:when test="$format = 'XML'">xml</xsl:when>
  344. <xsl:when test="$format = 'HTML'">
  345. <xsl:choose>
  346. <xsl:when test="$useInteractiveExt">mht</xsl:when>
  347. <xsl:otherwise>html</xsl:otherwise>
  348. </xsl:choose>
  349. </xsl:when>
  350. <xsl:when test="$format = 'XHTML'">
  351. <xsl:choose>
  352. <xsl:when test="$useInteractiveExt">mht</xsl:when>
  353. <xsl:otherwise>xhtml</xsl:otherwise>
  354. </xsl:choose>
  355. </xsl:when>
  356. <xsl:when test="$format = 'XLWA'">mht</xsl:when>
  357. <xsl:when test="$format = 'spreadsheetML' or $format='xlsxData'">xlsx</xsl:when>
  358. <xsl:when test="$format = 'spreadsheetMLOfficeConnectionEnabled'">xlsx</xsl:when>
  359. <xsl:when test="$format = 'singleXLS'">xls</xsl:when>
  360. <xsl:when test="$format = 'png'">png</xsl:when>
  361. </xsl:choose>
  362. </xsl:template>
  363. </xsl:stylesheet>
  364. </xts:block>
  365. <xts:block id="redirect" mode="output" processor="XSLT" type="exec" mimeType="text/html"
  366. condition=".[/root/env/param[@name='session_had_expired']]"
  367. dependency="">
  368. <xts:logicsheet path="logicsheets/portal.xsl"/>
  369. <xts:logicsheet path="logicsheets/presentation/main/framework.xsl"/>
  370. <xts:logicsheet path="logicsheets/presentation/main/presentation.xsl"/>
  371. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  372. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  373. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  374. <xts:logicsheet path="logicsheets/validation.xslt"/>
  375. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  376. <xsl:stylesheet version="1.0"
  377. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  378. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  379. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  380. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  381. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  382. xmlns:mt="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mt"
  383. exclude-result-prefixes="xsl pf xts xtsext dp">
  384. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  385. <pf:variables/>
  386. <xsl:template match="/root">
  387. <xsl:variable name="browserTitle">
  388. <xts:string id="IDS_COGNOS_REPORTS"/>
  389. </xsl:variable>
  390. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
  391. <head>
  392. <pf:meta/><!-- Standard meta tags -->
  393. <title><xts:string id="IDS_PORTAL"/></title>
  394. <pf:help context="HID_DOWNLOAD"/><!-- Help system -->
  395. <script language="javascript">
  396. function goHome()
  397. {
  398. document.location.href = "<xsl:value-of select="xtsext:javascriptencode($gateway)"/>?<xsl:value-of select="xtsext:javascriptencode(key('system-param', 'COGNOSHome'))"/>";
  399. }
  400. function init()
  401. {
  402. setTimeout('download.submit()',5);
  403. }
  404. function closePage()
  405. {
  406. var emptyHistoryThreshold = <xsl:choose><xsl:when test="$browser = 'ie'">0</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose>;
  407. <xsl:choose>
  408. <xsl:when test="string(/root/env/param[@name='backURL']) != ''">
  409. document.location.href = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='backURL']))"/>";
  410. </xsl:when>
  411. <xsl:otherwise> <!-- No BackURL provided -->
  412. // try to go back in history if we can
  413. if ( history.length > emptyHistoryThreshold )
  414. history.back();
  415. // try to close a win32 window if we appear inside of one
  416. else if (window.external &amp;&amp; window.external.HasOnClose)
  417. window.external.OnClose(1);
  418. // close the browser window
  419. else
  420. window.close();
  421. </xsl:otherwise>
  422. </xsl:choose>
  423. }
  424. </script>
  425. </head>
  426. <dp:header>
  427. <!-- header titles-->
  428. <dp:title showName="false">
  429. <xsl:value-of select="$browserTitle"/>
  430. </dp:title>
  431. <!-- header introduction -->
  432. <dp:close>
  433. <xsl:variable name="close"><xts:string id="IDS_CLOSE"/></xsl:variable>
  434. <a href="javascript:closePage();"><img height="16" width="16" class="dialogClose" vspace="2" border="0" src="{$skin_images}close.gif" alt="{$close}" onmouseover="this.className = 'dialogCloseOver'" onmouseout="this.className = 'dialogClose'"/></a>
  435. </dp:close>
  436. </dp:header>
  437. <form name="download" id="download" action="{$gateway}">
  438. <xsl:for-each select="/root/env/param[@name != 'session_had_expired']">
  439. <input type="hidden" name="{@name}" value="{.}"/>
  440. </xsl:for-each>
  441. </form>
  442. <mt:errorMessage>
  443. <xts:string id="IDS_DLD_ERR_PASSPORT_EXPIRED_INFO"/>
  444. <xsl:variable name="action">
  445. <a href="javascript:goHome()">
  446. <xts:string id="IDS_DLD_ERR_PASSPORT_EXPIRED_REDIRECT_TO_CC"/>
  447. </a>
  448. </xsl:variable>
  449. <br/>
  450. <xts:string id="IDS_DLD_ERR_PASSPORT_EXPIRED_ACTION">
  451. <xts:param name="pageAction">
  452. <xsl:copy-of select="$action"/>
  453. </xts:param>
  454. </xts:string>
  455. </mt:errorMessage>
  456. </dp:page>
  457. </xsl:template>
  458. </xsl:stylesheet>
  459. </xts:block>
  460. <xts:block id="setUpMessage" dependency="getContent" condition=".[not(/root/output/*[local-name() = 'part']) and not(/root/env/param[@name='session_had_expired'])]" type="exec" processor="XSLT">
  461. <xsl:stylesheet version="1.0"
  462. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  463. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  464. exclude-result-prefixes="xsl xtsext">
  465. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  466. <xsl:template match="/root">
  467. <xts:sequence>
  468. <xts:append>
  469. <displayMessage>
  470. <backURL><xsl:value-of select="/root/env/param[@name='backURL']"/></backURL>
  471. <message><xts:string id="IDS_DLD_ERR_OUPUT_NOT_EXIST"/></message>
  472. </displayMessage>
  473. </xts:append>
  474. </xts:sequence>
  475. </xsl:template>
  476. </xsl:stylesheet>
  477. </xts:block>
  478. <xts:block id="displayMessage" dependency="setUpMessage" condition=".[not(/root/output/*[local-name() = 'part']) and not(/root/env/param[@name='session_had_expired'])]" mandatory="false" mode="output" processor="XSLT" type="exec" mimeType="text/html" path="portal/display_message.xslt">
  479. <xts:logicsheet path="logicsheets/portal.xsl"/>
  480. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  481. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  482. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  483. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  484. </xts:block>
  485. </xts:morphlet>