preview_style.xts 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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, 2015
  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. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="logicsheets/formlogic_init.xslt"/>
  14. <xts:block id="getContent" processor="XSLT" type="exec" mode="interpret" dependency="formlogic_init">
  15. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  16. <xsl:stylesheet version="1.0"
  17. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  18. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  19. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  20. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  21. <xsl:template match="/">
  22. <xts:sequence>
  23. <xts:append>
  24. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  25. <send:request provider="cm">
  26. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  27. <cm:query>
  28. <cm:search>
  29. <xsl:choose>
  30. <xsl:when test="/root/env/param[@name='m_po_skin']!=''">
  31. <xsl:value-of select="/root/env/param[@name='m_po_skin']"/>
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <xsl:value-of select="/root/env/param[@name='m_obj']"/>
  35. </xsl:otherwise>
  36. </xsl:choose>
  37. </cm:search>
  38. <cm:properties>
  39. <cm:property name="defaultName"/>
  40. <cm:property name="previewImageLocation"/>
  41. <cm:property name="resourceLocation"/>
  42. </cm:properties>
  43. </cm:query>
  44. </xts:transform>
  45. </send:request>
  46. </xts:transform>
  47. </xts:append>
  48. </xts:sequence>
  49. </xsl:template>
  50. </xsl:stylesheet>
  51. </xts:block>
  52. <xts:block id="format" dependency="getContent" mode="output" processor="XSLT" type="exec" mimeType="text/html">
  53. <xts:logicsheet path="logicsheets/portal.xsl"/>
  54. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  55. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  56. <xts:logicsheet path="logicsheets/presentation/main/presentation.xsl"/>
  57. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  58. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  59. <xts:logicsheet path="logicsheets/validation.xslt"/>
  60. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  61. <xsl:stylesheet version="1.0"
  62. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  63. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  64. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  65. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  66. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  67. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  68. xmlns:mt="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mt"
  69. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  70. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  71. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  72. exclude-result-prefixes="xsl xts lyt pf dp df utml cm mt">
  73. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  74. <pf:variables/>
  75. <xsl:variable name="mname" select="'preview_style.xts'"/>
  76. <xsl:variable name="the-object" select="/root/cm:queryResponse/cm:portalSkin"/>
  77. <!-- start the output -->
  78. <xsl:template match="/root">
  79. <xsl:variable name="browserTitle">
  80. <xts:string id="IDS_STYLE_PREVIEW_TITLE"/>
  81. <span lang="{$contentLocale}"><xsl:value-of select="$the-object/cm:defaultName"/></span>
  82. </xsl:variable>
  83. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
  84. <dp:meta>
  85. <pf:meta/> <!-- Standard meta tags -->
  86. </dp:meta>
  87. <dp:script>
  88. <pf:help context="HID_PERSONALIZE"/> <!-- Help system -->
  89. <pf:dojo>
  90. <require>dijit.dijit</require>
  91. </pf:dojo>
  92. </dp:script>
  93. <script language="javascript">
  94. function closePage()
  95. {
  96. document.pform.ps_nav_op.value = "maintain";
  97. document.pform.m.value = "<xsl:value-of select="xtsext:javascriptencode(string(key('env-param', 'p_style_back')))"/>";
  98. document.pform.submit();
  99. }
  100. </script>
  101. <xsl:variable name="preview" select="$the-object/cm:previewImageLocation"/>
  102. <xsl:variable name="skinFolderName" select="$the-object/cm:resourceLocation"/>
  103. <xsl:variable name="preview_image">
  104. <xsl:choose>
  105. <!-- Ignore external URLs -->
  106. <xsl:when test="contains($preview,':/') or contains($preview,'\\') or contains($preview,'//')">
  107. <!-- blank -->
  108. </xsl:when>
  109. <!-- Relative / Absolute URLs - Checking for \ is probably useless in this case -->
  110. <xsl:when test="contains($preview,'/') or contains($preview,'\')">
  111. <xsl:choose>
  112. <!-- Relative that doesn't start with / -->
  113. <xsl:when test="not(starts-with($preview, '.') or starts-with($preview, '/'))">
  114. <xsl:value-of select="$webRoot"/>/<xsl:value-of select="$preview"/>
  115. </xsl:when>
  116. <!-- Relative that starts with / -->
  117. <xsl:when test="starts-with($preview, '/')">
  118. <xsl:value-of select="$webRoot"/><xsl:value-of select="$preview"/>
  119. </xsl:when>
  120. <!-- Relative that starts with ../ -->
  121. <xsl:otherwise>
  122. <xsl:value-of select="$preview"/>
  123. </xsl:otherwise>
  124. </xsl:choose>
  125. </xsl:when>
  126. <!-- Just a file name -->
  127. <xsl:when test="$preview != ''">
  128. <xsl:value-of select="concat($skincontent, '/', $skinFolderName, '/', $preview)"/>
  129. </xsl:when>
  130. </xsl:choose>
  131. </xsl:variable>
  132. <utml:form name="pform" method="post" action="{$gateway}">
  133. <!-- dialog header -->
  134. <dp:header help="true" div="div">
  135. <!-- header titles-->
  136. <dp:title showName="false">
  137. <span id="lbl_pageTitle"><xsl:copy-of select="$browserTitle"/></span>
  138. </dp:title>
  139. <!-- header introduction -->
  140. <dp:close>
  141. <a>
  142. <xsl:attribute name="href">
  143. <xsl:choose>
  144. <xsl:when test="key('env-param', 'p_style_back')">javascript:closePage();</xsl:when>
  145. <xsl:otherwise>
  146. <xsl:value-of select="key('env-param', 'backURL')"/>
  147. </xsl:otherwise>
  148. </xsl:choose>
  149. </xsl:attribute>
  150. <dp:closeMarker/>
  151. </a>
  152. </dp:close>
  153. </dp:header>
  154. <xsl:choose>
  155. <xsl:when test="$preview_image != ''">
  156. <xsl:element name="iframe">
  157. <xsl:attribute name="src">
  158. <xsl:value-of select="$preview_image"/>
  159. </xsl:attribute>
  160. <xsl:attribute name="id">previewContent</xsl:attribute>
  161. <xsl:attribute name="width">100%</xsl:attribute>
  162. <xsl:attribute name="height">100%</xsl:attribute>
  163. <xsl:attribute name="aria-labelledby">lbl_pageTitle</xsl:attribute>
  164. </xsl:element>
  165. </xsl:when>
  166. <xsl:otherwise>
  167. <lyt:layout style="1">
  168. <lyt:section>
  169. <dp:text>
  170. <mt:objectNoneFound id="IDS_STYLE_NO_PREVIEW"/>
  171. </dp:text>
  172. </lyt:section>
  173. </lyt:layout>
  174. </xsl:otherwise>
  175. </xsl:choose>
  176. <dp:footer div="div">
  177. <xsl:choose>
  178. <xsl:when test="key('env-param', 'p_style_back')">
  179. <df:button df:id="IDS_CLOSE" df:style="href" df:href="javascript:closePage();"/>
  180. </xsl:when>
  181. <xsl:otherwise>
  182. <df:button df:id="IDS_CLOSE" df:style="back-url"/>
  183. </xsl:otherwise>
  184. </xsl:choose>
  185. </dp:footer>
  186. </utml:form>
  187. <script language="javascript">
  188. var iframe = document.getElementById('previewContent');
  189. iframe.onload= function() {
  190. var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
  191. setTimeout(function(){iframe.height = innerDoc.body.scrollHeight + "px";},2);
  192. dojo.connect(innerDoc.body, 'onmousedown', function(e){
  193. dojo.stopEvent(e);
  194. },true);
  195. var previewFrame = dojo.byId("previewContent")
  196. previewFrame.setAttribute("aria-hidden","true");
  197. dojo.query("*", previewFrame).forEach( function(ele) {
  198. if (dijit.isTabNavigable(ele)) {
  199. ele.tabIndex = -1;
  200. }
  201. });
  202. }
  203. </script>
  204. </dp:page>
  205. </xsl:template>
  206. </xsl:stylesheet>
  207. </xts:block>
  208. <!-- Debug -->
  209. <xts:block id="debug" type="exec" dependency="format" mode="output" condition=".[ /root/session/param[@name='debug'] = '1' ]" processor="XSLT" mandatory="false" mimeType="text/html" >
  210. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  211. <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">
  212. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  213. <dbg:templates/>
  214. <xsl:template match="/">
  215. <dbg:dumpxml select="/root"/>
  216. </xsl:template>
  217. </xsl:stylesheet>
  218. </xts:block>
  219. </xts:morphlet>