view.xslt 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2018
  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. <!-- $Header$ -->
  13. <!-- $DateTime$ -->
  14. <!-- $Change$ -->
  15. <xsl:stylesheet version="1.0"
  16. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  17. xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
  18. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  19. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  20. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  21. xmlns:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
  22. xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
  23. exclude-result-prefixes="wsrp SOAP-ENV xts xtsext ui nav">
  24. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  25. <xsl:attribute-set name="anchor">
  26. <xsl:attribute name="class">cognos-anchor</xsl:attribute>
  27. <xsl:attribute name="onmouseover">window.status='';return true;</xsl:attribute>
  28. <xsl:attribute name="onmouseout">window.status='';return true;</xsl:attribute>
  29. </xsl:attribute-set>
  30. <xsl:variable name="portlet-op" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
  31. <xsl:variable name="portlet-registration-params" select="$portlet-op/wsrp:registrationContext/wsrp:registrationState/param"/>
  32. <xsl:variable name="consumerAgent" select="$portlet-registration-params[@name='consumerAgent']"/>
  33. <xsl:variable name="redirect-url" select="/root/nav:getItemResponse/nav:redirectURL"/>
  34. <ui:property name="display-id" select="'display_id'"/>
  35. <ui:property name="display-width" select="'display_width'"/>
  36. <ui:property name="display-height" select="'display_height'"/>
  37. <ui:property name="display-action" select="'display_action'"/>
  38. <ui:property name="view-action" select="'view_action'"/>
  39. <ui:property name="publish-spec" select="'publish_spec'"/>
  40. <ui:property name="discussion-spec" select="'discussion_spec'"/>
  41. <ui:property name="publish-no-prompt" select="'publish_no_prompt'"/>
  42. <ui:property name="viewer-resize" select="'viewer_resize'"/>
  43. <ui:property name="session-id" select="'session_id'" exclude-session-state="$ui-session-params[@name = 'display_id'] = ''"/>
  44. <xsl:variable name="session-id-param">
  45. <xsl:text>_CPSID_</xsl:text>
  46. <xsl:value-of select="$session-id"/>
  47. </xsl:variable>
  48. <xsl:variable name="item" select="/root/nav:getItemResponse/nav:item | /root/nav:getItemResponse/nav:shortcut"/>
  49. <xsl:variable name="run-only" select="$item/nav:action[nav:name = 'run']"/>
  50. <xsl:variable name="run-options" select="$item/nav:action[nav:name = 'run_options']"/>
  51. <xsl:variable name="url-item" select="$item/nav:defaultAction/nav:url"/>
  52. <!-- create browser variable: $ui-browser -->
  53. <ui:browser/>
  54. <xsl:variable name="is-powerplay" select="($item/nav:type = 'powerPlayReport') or ($item[self::nav:shortcut] and ($item/*/nav:type = 'powerPlayReport'))"/>
  55. <xsl:variable name="is-pagelet" select="($item/nav:type = 'pagelet') or ($item[self::nav:shortcut] and ($item/*/nav:type = 'pagelet'))"/>
  56. <xsl:variable name="is-dashboard" select="($item/nav:type = 'dashboard') or ($item[self::nav:shortcut] and ($item/*/nav:type = 'dashboard'))"/>
  57. <xsl:variable name="is-document" select="$item/nav:type='document' or ($item[self::nav:shortcut] and $item/*/nav:type='document')"/>
  58. <xsl:variable name="is-powerplay-8" select="($item/nav:type = 'powerPlay8Report') or ($item[self::nav:shortcut] and ($item/*/nav:type = 'powerPlay8Report')) or ($item/nav:type = 'powerPlay8ReportView') or ($item[self::nav:shortcut] and ($item/*/nav:type = 'powerPlay8ReportView'))"/>
  59. <xsl:variable name="is-documentContent" select="($item/nav:type = 'documentContent') or ($item[self::nav:shortcut] and ($item/*/nav:type = 'documentContent'))"/>
  60. <xsl:variable name="canView" select="($item/nav:action/nav:name = 'previous_versions') or ( $url-item/@type = 'external' ) or ( $run-only ) or $is-pagelet or $is-dashboard or $is-documentContent"/>
  61. <xsl:variable name="show-run-action" select="$display-action='prompt' or ($display-action='view' and not($canView) and $view-action='prompt')"/>
  62. <xsl:variable name="url-view">
  63. <xsl:variable name="url">
  64. <xsl:choose>
  65. <xsl:when test="$is-dashboard and ($url-item)">
  66. <xsl:choose>
  67. <xsl:when test="contains($url-item,'?')">
  68. <xsl:value-of select="concat($url-item,'&amp;m_session=', $session-id-param)"/>
  69. </xsl:when>
  70. <xsl:otherwise>
  71. <xsl:value-of select="concat($url-item,'?m_session=', $session-id-param)"/>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. </xsl:when>
  75. <xsl:otherwise>
  76. <xsl:value-of select="$url-item"/>
  77. </xsl:otherwise>
  78. </xsl:choose>
  79. </xsl:variable>
  80. <xsl:choose>
  81. <xsl:when test="$redirect-url != '' and not($url-item/@type = 'external')">
  82. <xsl:value-of select="concat($redirect-url, xtsext:protect( xtsext:urlencode(string($url)), 'url', 'url', 'getdata' ))"/>
  83. </xsl:when>
  84. <xsl:otherwise>
  85. <xsl:value-of select="$url"/>
  86. </xsl:otherwise>
  87. </xsl:choose>
  88. </xsl:variable>
  89. <xsl:variable name="url-run">
  90. <xsl:choose>
  91. <!-- check for "run options" first... -->
  92. <xsl:when test="$run-options/nav:url != ''">
  93. <xsl:variable name="runurl-with-session-param">
  94. <xsl:value-of select="concat($run-options/nav:url, '&amp;m_session=', $session-id-param)"/>
  95. <!-- for sharepoint, we instruct the viewer to save the conversation in the session as well, so subsequent publish would use the same conversation -->
  96. <xsl:if test="$consumerAgent = 'sharepoint'">
  97. <xsl:value-of select="concat('&amp;m_sessionConv=', $session-id-param)"/>
  98. </xsl:if>
  99. </xsl:variable>
  100. <xsl:choose>
  101. <xsl:when test="($redirect-url != '') and not($run-options/nav:url/@type = 'external')">
  102. <xsl:value-of select="concat($redirect-url, xtsext:protect( xtsext:urlencode($runurl-with-session-param), 'url', 'url', 'getdata' ))"/>
  103. </xsl:when>
  104. <xsl:otherwise>
  105. <xsl:value-of select="$runurl-with-session-param"/>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. </xsl:when>
  109. <!-- ...then check for simple "run" second... -->
  110. <xsl:when test="$run-only/nav:url != ''">
  111. <xsl:choose>
  112. <xsl:when test="($redirect-url != '') and not($run-only/nav:url/@type = 'external')">
  113. <xsl:value-of select="concat($redirect-url, xtsext:protect( xtsext:urlencode(concat($run-only/nav:url, '&amp;m_session=', $session-id-param)), 'url', 'url', 'getdata' ))"/>
  114. </xsl:when>
  115. <xsl:otherwise>
  116. <xsl:value-of select="concat($run-only/nav:url, '&amp;m_session=', $session-id-param)"/>
  117. </xsl:otherwise>
  118. </xsl:choose>
  119. </xsl:when>
  120. <!-- ...otherwise nothing to do. -->
  121. </xsl:choose>
  122. </xsl:variable>
  123. <xsl:variable name="iFrameSrc">
  124. <xsl:choose>
  125. <xsl:when test=" $ui-browser = 'ie' or $ui-browser = 'moz' ">
  126. <xsl:text>about:blank</xsl:text>
  127. </xsl:when>
  128. <xsl:otherwise>
  129. <xsl:value-of select="concat($ui-producer-images, 'space.gif')"/>
  130. </xsl:otherwise>
  131. </xsl:choose>
  132. </xsl:variable>
  133. <xsl:template match="/">
  134. <!--
  135. Input conditions:
  136. ================
  137. $canView output is available and can be viewed.
  138. $run-options can run with options?
  139. $run-only can just run it?
  140. $ui-browser ie, moz, ns4 or other
  141. $display-action view, prompt or run
  142. $view-action prompt or run
  143. -->
  144. <xsl:if test="$ui-session-params[@name='display_id'] != ''">
  145. <div class="portlet-form-field">
  146. <a href="wsrp_rewrite?wsrp-urlType=blockingAction&amp;wsrp-interactionState=set:{$ui-state-params[@name = 'channel']}&amp;wsrp-windowState={$ui-window-state}&amp;wsrp-navigationalState=&amp;display_id=/wsrp_rewrite"><xts:string id="IDS_NAV_VEW_BACK_TO_DEFAULT"/></a>
  147. </div>
  148. <br/>
  149. </xsl:if>
  150. <xsl:choose>
  151. <xsl:when test="/root/recursive-error">
  152. <xsl:call-template name="render-error-page">
  153. <xsl:with-param name="type">recursive</xsl:with-param>
  154. </xsl:call-template>
  155. </xsl:when>
  156. <!--
  157. If the url type is external and we don't have a run url or if the object type is "document", we default the action to view.
  158. -->
  159. <xsl:when test="$display-action = 'view' or ($url-item/@type = 'external' and not($run-options or $run-only)) or $is-document or $is-pagelet or $is-dashboard">
  160. <xsl:choose>
  161. <xsl:when test="$canView = 'true'">
  162. <xsl:choose>
  163. <xsl:when test="$is-document">
  164. <xsl:call-template name="render-action-page">
  165. <xsl:with-param name="type">download</xsl:with-param>
  166. <xsl:with-param name="url" select="$url-view"/>
  167. <xsl:with-param name="img-url" select="$item/nav:imgURL"/>
  168. </xsl:call-template>
  169. </xsl:when>
  170. <xsl:when test="$ui-browser = 'ns4' or $ui-browser = 'ns6' or $ui-browser = 'ns70' or $ui-browser = 'other'">
  171. <xsl:call-template name="render-action-page">
  172. <xsl:with-param name="type">view</xsl:with-param>
  173. <xsl:with-param name="url" select="$url-view"/>
  174. </xsl:call-template>
  175. </xsl:when>
  176. <xsl:otherwise>
  177. <xsl:call-template name="render-iframe">
  178. <xsl:with-param name="url" select="$url-view"/>
  179. </xsl:call-template>
  180. </xsl:otherwise>
  181. </xsl:choose>
  182. </xsl:when>
  183. <xsl:when test="$run-options">
  184. <xsl:choose>
  185. <xsl:when test="($view-action = 'prompt' ) or ($ui-browser = 'ns4' or $ui-browser = 'ns6' or $ui-browser = 'ns70' or $ui-browser = 'other')">
  186. <xsl:choose>
  187. <xsl:when test="$is-powerplay">
  188. <xsl:call-template name="render-action-page">
  189. <xsl:with-param name="type">run</xsl:with-param>
  190. <xsl:with-param name="url" select="$url-view"/>
  191. </xsl:call-template>
  192. </xsl:when>
  193. <xsl:otherwise>
  194. <xsl:call-template name="render-action-page">
  195. <xsl:with-param name="type">run</xsl:with-param>
  196. <xsl:with-param name="url" select="$url-run"/>
  197. </xsl:call-template>
  198. </xsl:otherwise>
  199. </xsl:choose>
  200. </xsl:when>
  201. <xsl:otherwise>
  202. <xsl:choose>
  203. <xsl:when test="$is-powerplay">
  204. <xsl:call-template name="render-iframe">
  205. <xsl:with-param name="url" select="$url-view"/>
  206. </xsl:call-template>
  207. </xsl:when>
  208. <xsl:otherwise>
  209. <xsl:call-template name="render-iframe">
  210. <xsl:with-param name="url" select="$url-run"/>
  211. </xsl:call-template>
  212. </xsl:otherwise>
  213. </xsl:choose>
  214. </xsl:otherwise>
  215. </xsl:choose>
  216. </xsl:when>
  217. <xsl:otherwise>
  218. <xsl:call-template name="render-error-page">
  219. <xsl:with-param name="type">view</xsl:with-param>
  220. </xsl:call-template>
  221. </xsl:otherwise>
  222. </xsl:choose>
  223. </xsl:when>
  224. <xsl:otherwise>
  225. <xsl:choose>
  226. <xsl:when test="$run-options or $run-only">
  227. <xsl:choose>
  228. <xsl:when test="$ui-browser = 'ns4' or $ui-browser = 'ns6' or $ui-browser = 'ns70' or $ui-browser = 'other'">
  229. <xsl:call-template name="render-action-page">
  230. <xsl:with-param name="type">run</xsl:with-param>
  231. <xsl:with-param name="url" select="$url-run"/>
  232. </xsl:call-template>
  233. </xsl:when>
  234. <xsl:when test="$display-action = 'prompt'">
  235. <xsl:choose>
  236. <xsl:when test="$is-powerplay">
  237. <xsl:call-template name="render-action-page">
  238. <xsl:with-param name="type">prompt</xsl:with-param>
  239. <xsl:with-param name="url" select="$url-view"/>
  240. </xsl:call-template>
  241. </xsl:when>
  242. <xsl:otherwise>
  243. <xsl:call-template name="render-action-page">
  244. <xsl:with-param name="type">prompt</xsl:with-param>
  245. <xsl:with-param name="url" select="$url-run"/>
  246. </xsl:call-template>
  247. </xsl:otherwise>
  248. </xsl:choose>
  249. </xsl:when>
  250. <xsl:otherwise>
  251. <xsl:choose>
  252. <xsl:when test="$is-powerplay">
  253. <xsl:call-template name="render-iframe">
  254. <xsl:with-param name="url" select="$url-view"/>
  255. </xsl:call-template>
  256. </xsl:when>
  257. <xsl:otherwise>
  258. <xsl:call-template name="render-iframe">
  259. <xsl:with-param name="url" select="$url-run"/>
  260. </xsl:call-template>
  261. </xsl:otherwise>
  262. </xsl:choose>
  263. </xsl:otherwise>
  264. </xsl:choose>
  265. </xsl:when>
  266. <xsl:otherwise>
  267. <xsl:call-template name="render-error-page">
  268. <xsl:with-param name="type">run</xsl:with-param>
  269. </xsl:call-template>
  270. </xsl:otherwise>
  271. </xsl:choose>
  272. </xsl:otherwise>
  273. </xsl:choose>
  274. <ui:preview/>
  275. </xsl:template>
  276. <xsl:template name="render-action-page">
  277. <xsl:param name="type"/>
  278. <xsl:param name="url"/>
  279. <xsl:param name="img-url"/>
  280. <div id="wsrp_rewrite_run">
  281. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  282. <tr>
  283. <td class="portlet-font" align="center" valign="middle">
  284. <xsl:attribute name="height">
  285. <xsl:choose>
  286. <xsl:when test="$display-height!=''"><xsl:value-of select="$display-height"/></xsl:when>
  287. <xsl:otherwise>100</xsl:otherwise>
  288. </xsl:choose>
  289. </xsl:attribute>
  290. <xsl:choose>
  291. <xsl:when test="$type = 'run'">
  292. <xsl:text/><xts:string id="IDS_NAV_VEW_CLICK_RUN_WITH_OPTIONS"/><br/><br/>
  293. <a xsl:use-attribute-sets="anchor" href="{ $url }" target="cps_{ $item/nav:id }_run">
  294. <img width="20" height="20" border="0" src="{ $ui-producer-images }action_run_report_20.gif" alt="{ $run-options/nav:alt }" title="{ $run-options/nav:alt }"/>
  295. </a>
  296. </xsl:when>
  297. <xsl:when test="$type = 'view'">
  298. <xsl:text/><xts:string id="IDS_NAV_VEW_CLICK_VIEW"/><br/><br/>
  299. <a xsl:use-attribute-sets="anchor" href="{ $url }" target="cps_view">
  300. <img width="20" height="20" border="0" src="{ $ui-producer-images }action_view_report_20.gif"/>
  301. </a>
  302. </xsl:when>
  303. <xsl:when test="$type = 'prompt'">
  304. <script language="javascript">
  305. function wsrp_rewrite_showreport( e ) {
  306. var oDiv = document.getElementById("wsrp_rewrite_run");
  307. var oIFrame = document.getElementById("wsrp_rewrite_iframe");
  308. oDiv.style.display = "none";
  309. var busyDiv = document.getElementById("wsrp_rewrite_busydiv");
  310. busyDiv.style.display="";
  311. var frameUrl = "<xsl:value-of select="xtsext:javascriptencode($url)"/>";
  312. if (window.wsrp_rewrite_iframeWrapper){
  313. wsrp_rewrite_setFrameLocation(wsrp_rewrite_iframeWrapper, frameUrl)
  314. } else {
  315. oIFrame.src = frameUrl;
  316. }
  317. oIFrame.style.display = "block";
  318. // stop event propogation, no one above us needs to know about this.
  319. if ( e.srcElement ) {
  320. e.returnValue = false;
  321. } else {
  322. e.preventDefault();
  323. }
  324. }
  325. </script>
  326. <xsl:text/><xts:string id="IDS_NAV_VEW_CLICK_RUN"/><br/><br/>
  327. <a xsl:use-attribute-sets="anchor" href="#" onclick="wsrp_rewrite_showreport( event );">
  328. <img width="20" height="20" border="0" src="{ $ui-producer-images }action_run_report_20.gif">
  329. <xsl:attribute name="alt"><xts:string id="IDS_NAV_VEW_RUN_NOW"/></xsl:attribute>
  330. <xsl:attribute name="title"><xts:string id="IDS_NAV_VEW_RUN_NOW"/></xsl:attribute>
  331. </img>
  332. </a>
  333. </xsl:when>
  334. <xsl:when test="$type='download'">
  335. <xsl:variable name="text"><xts:string id="IDS_NAV_VEW_CLICK_VIEW_DOC"/></xsl:variable>
  336. <xsl:text/><xsl:value-of select="$text"/><br/><br/>
  337. <a xsl:use-attribute-sets="anchor" href="{ $url }">
  338. <img width="16" height="16" border="0" src="{ $img-url }" alt="{ $text }" title="{ $text }"/>
  339. </a>
  340. </xsl:when>
  341. <xsl:otherwise><xts:string id="IDS_NAV_VEW_CONTACT_ADMINISTRATOR"/></xsl:otherwise>
  342. </xsl:choose>
  343. </td>
  344. </tr>
  345. </table>
  346. </div>
  347. <xsl:if test="$type = 'prompt'">
  348. <xsl:call-template name="render-iframe">
  349. <xsl:with-param name="url">about:blank</xsl:with-param>
  350. <xsl:with-param name="hidden" select="true()"/>
  351. </xsl:call-template>
  352. </xsl:if>
  353. </xsl:template>
  354. <xsl:template name="render-error-page">
  355. <xsl:param name="type"/>
  356. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  357. <tr>
  358. <td class="portlet-font" align="center" valign="middle" height="100">
  359. <xsl:choose>
  360. <xsl:when test="$type = 'view'"><xts:string id="IDS_NAV_VEW_CANNOT_VIEW_ERROR"/></xsl:when>
  361. <xsl:when test="$type = 'run'"><xts:string id="IDS_NAV_VEW_CANNOT_RUN_ERROR"/></xsl:when>
  362. <xsl:when test="$type = 'recursive'"><xts:string id="IDS_NAV_VEW_RECURSIVE_CALL_ERROR"/></xsl:when>
  363. </xsl:choose>
  364. <br/><xts:string id="IDS_NAV_VEW_CONTACT_ADMINISTRATOR"/><br/>
  365. </td>
  366. </tr>
  367. </table>
  368. </xsl:template>
  369. <xsl:template name="render-iframe">
  370. <xsl:param name="url"/>
  371. <xsl:param name="hidden" select="false()"/>
  372. <xsl:choose>
  373. <xsl:when test="$consumerAgent = 'websphere'">
  374. <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
  375. <tbody>
  376. <tr>
  377. <td>
  378. <xsl:call-template name="render-iframe-details">
  379. <xsl:with-param name="url" select="$url"/>
  380. <xsl:with-param name="hidden" select="$hidden"/>
  381. </xsl:call-template>
  382. </td>
  383. </tr>
  384. </tbody>
  385. </table>
  386. </xsl:when>
  387. <xsl:otherwise>
  388. <xsl:call-template name="render-iframe-details">
  389. <xsl:with-param name="url" select="$url"/>
  390. <xsl:with-param name="hidden" select="$hidden"/>
  391. </xsl:call-template>
  392. </xsl:otherwise>
  393. </xsl:choose>
  394. </xsl:template>
  395. <xsl:template name="render-iframe-details">
  396. <xsl:param name="url"/>
  397. <xsl:param name="hidden" select="false()"/>
  398. <xsl:variable name="is-external" select="$item/nav:defaultAction/nav:url/@type ='external'"/>
  399. <xsl:variable name="third-party-portal" select="not ($ui-is-cognos-connection or $ui-is-myportal)"/>
  400. <xsl:choose>
  401. <xsl:when test="not($is-external) and $third-party-portal">
  402. <!-- If the url is not external and we are in 3rd party portals, we will add the code to synchronize iframe requests -->
  403. <script language="javascript">
  404. <xsl:choose>
  405. <xsl:when test="$consumerAgent = 'sap'">
  406. var wsrp_rewrite_scope;
  407. if (window.parent)
  408. wsrp_rewrite_scope = window.parent;
  409. else
  410. wsrp_rewrite_scope = window;
  411. </xsl:when>
  412. <xsl:otherwise>
  413. var wsrp_rewrite_scope = window;
  414. </xsl:otherwise>
  415. </xsl:choose>
  416. <!--
  417. Producer registration handle. Used in the cookie that we use to keep track if we already synchronized the viewers or not.
  418. if this handle is in the cookie, it means that we already synchronized the request and we have a passport cookie.
  419. -->
  420. var wsrp_rewrite_reghandle = "<xsl:value-of select="xtsext:javascriptencode($portlet-op/wsrp:registrationContext/wsrp:registrationHandle)"/>";
  421. <!--
  422. InitCookie session id included in the request as extension. This id is generated when there is an initCookie request.
  423. It is used to keep track when we have a new initCookie so we can clear the passport
  424. -->
  425. var wsrp_rewrite_sessionId = "<xsl:value-of select="$portlet-op/wsrp:markupParams/wsrp:extensions/*[local-name()='applicationState']/*[local-name()='cookieSessionId']"/>";
  426. function wsrp_rewrite_getCookie(name){
  427. var value = null;
  428. if (document.cookie.length > 0){
  429. var search = name + "="
  430. var index = document.cookie.indexOf(search);
  431. if (index != -1){
  432. var start = index + search.length;
  433. var end = document.cookie.indexOf(";", start);
  434. if (end == -1)
  435. end = document.cookie.length;
  436. value = unescape(document.cookie.substring(start, end))
  437. }
  438. }
  439. return value;
  440. }
  441. function wsrp_rewrite_setCookie(name, value){
  442. document.cookie = name + "=" + value +"; path=/";
  443. }
  444. <!--
  445. Check if we already synchronized the viewer and we have the passport cookie set
  446. -->
  447. function wsrp_rewrite_isAuthenticated(){
  448. var authString = wsrp_rewrite_reghandle +"_" + wsrp_rewrite_sessionId;
  449. var authState = wsrp_rewrite_getCookie("cpsviewer_authstate");
  450. if (authState != null &amp;&amp; authState.indexOf(authString) != -1)
  451. return true;
  452. return false;
  453. }
  454. <!--
  455. Detect the scenario where we already have a passport cookie, but the cookie might be expired.
  456. This is done by using the value of the initCookie session id that we get from the consumer.
  457. If this values changes, it means that initCookie was called and we need to clear the passport cookie.
  458. -->
  459. function wsrp_rewrite_isReAuthenticated(){
  460. var reAuth = false;
  461. if (!wsrp_rewrite_isAuthenticated()){
  462. var authState = wsrp_rewrite_getCookie("cpsviewer_authstate");
  463. if (authState != null){
  464. var handles = authState.split(",");
  465. for (var i =0; i &lt; handles.length; i++){
  466. if (handles[i].indexOf(wsrp_rewrite_reghandle + "_") == 0){
  467. reAuth = true;
  468. break;
  469. }
  470. }
  471. }
  472. }
  473. return reAuth;
  474. }
  475. <!--
  476. Helper method that will set a cookie that is used to track whether we already have a passport cookie or not
  477. We will not synchronize the iframes, if this cookie is present.
  478. -->
  479. function wsrp_rewrite_setAuthenticated(){
  480. var authString = wsrp_rewrite_reghandle +"_" + wsrp_rewrite_sessionId;
  481. var authState = wsrp_rewrite_getCookie("cpsviewer_authstate");
  482. if (authState == null || authState == "")
  483. authState = authString;
  484. else if (authState.indexOf(wsrp_rewrite_reghandle) == -1)
  485. authState += "," + authString;
  486. wsrp_rewrite_setCookie("cpsviewer_authstate", authState);
  487. }
  488. <!--
  489. Helper method that will remove the cookie that is used to track whether we already have a passport cookie or not
  490. -->
  491. function wsrp_rewrite_setNotAuthenticated(){
  492. var authState = wsrp_rewrite_getCookie("cpsviewer_authstate");
  493. if (authState != null){
  494. var handles = authState.split(",");
  495. var newAuthState = "";
  496. for (var i =0; i &lt; handles.length; i++){
  497. if (handles[i].indexOf(wsrp_rewrite_reghandle +"_") != 0){
  498. if (newAuthState != "")
  499. newAuthState +=",";
  500. newAuthState += handles[i];
  501. }
  502. }
  503. wsrp_rewrite_setCookie("cpsviewer_authstate", newAuthState);
  504. }
  505. }
  506. <!--
  507. Build a url that will be used to trigger the login page so we can clear the passport cookie.
  508. This will be used when the passport has expired and we would like to clear the cookie
  509. -->
  510. function wsrp_rewrite_getAuthURL(){
  511. var url = "<xsl:value-of select="xtsext:javascriptencode($url)"/>";
  512. var index = url.indexOf("?");
  513. if (index != -1)
  514. url = url.substring(0, index);
  515. url += "?b_action=xts.run&amp;m=/cps4/common/sso.xts"
  516. return url
  517. }
  518. <!--
  519. Controller object.
  520. -->
  521. function _F_CPSIFrameController(){
  522. this.iframes = new Array();
  523. this.started = false;
  524. this.notified = false;
  525. this.isClearingCookie = false;
  526. this.clearCookie = false
  527. }
  528. <!--
  529. This method is called when we want to add an iframe to the controller so it can be synchronized.
  530. This method will do different thing depending on the state of the controller.
  531. If the controller is marked to clear the cookie:
  532. 1- remove the cookie that tracks whether we are authenticated or not ( call setNotAuthenticated)
  533. 2- Mark the state of the controller as "clearingCookie"
  534. 3- Queue the iframe that is being added to the controller so it can be processed later
  535. 4- create an iframe that will trigger the login page so that the passport cookies is cleared.
  536. If the controller state is "clearingCookie":
  537. 1- Queue the iframe so it can be processed later
  538. If we are already authenticated:
  539. 1- Set the location of the iframe. No need to synchronize.
  540. if the controller hasn't started yet:
  541. 1- mark the controller as started.
  542. 2- set the location of the first iframe.
  543. if the controller is already notified:
  544. 1 - set the location of the iframe
  545. Otherwise:
  546. 1- Queue the iframe so it can be processed later (once the controller is notified)
  547. -->
  548. function wsrp_rewrite_addFrameToController(iframe) {
  549. if (wsrp_rewrite_controller.clearCookie){
  550. wsrp_rewrite_setNotAuthenticated();
  551. wsrp_rewrite_controller.clearCookie = false;
  552. wsrp_rewrite_controller.isClearingCookie = true;
  553. wsrp_rewrite_controller.iframes.push(iframe);
  554. window.wsrp_rewrite_loginIframeWrapper = new _F_CPSIFrame("wsrp_rewrite_clearcookie", wsrp_rewrite_getAuthURL(), document);
  555. wsrp_rewrite_setFrameLocation(window.wsrp_rewrite_loginIframeWrapper);
  556. }else if(wsrp_rewrite_controller.isClearingCookie){
  557. wsrp_rewrite_controller.iframes.push(iframe);
  558. }else if (wsrp_rewrite_isAuthenticated()){
  559. wsrp_rewrite_setFrameLocation(iframe);
  560. }else if (!wsrp_rewrite_controller.started ){
  561. wsrp_rewrite_controller.started = true;
  562. wsrp_rewrite_setFrameLocation(iframe);
  563. } else if (wsrp_rewrite_controller.notified ){
  564. wsrp_rewrite_setFrameLocation(iframe) ;
  565. }else{
  566. wsrp_rewrite_controller.iframes.push(iframe);
  567. }
  568. }
  569. <!--
  570. This method is called when and iframe content is loaded.
  571. If the controller state is "clearingCookie", we will do the following:
  572. 1 - The "clearingCookie" state will be cleared
  573. 2 - We will set the location of the first iframe.
  574. Otherwise, we will do the following:
  575. 1 - Mark the state of the controller as "notified"
  576. 2 - Set the location of all iframes.
  577. 3 - Set a cookie so we can tell that we are authenticated (passport cookie is set)
  578. -->
  579. function wsrp_rewrite_notifyController(){
  580. if(wsrp_rewrite_controller.isClearingCookie){
  581. wsrp_rewrite_controller.isClearingCookie = false;
  582. // start the first request..
  583. if (wsrp_rewrite_controller.iframes.length > 0)
  584. wsrp_rewrite_setFrameLocation(wsrp_rewrite_controller.iframes.pop());
  585. }else{
  586. wsrp_rewrite_controller.notified = true;
  587. while (wsrp_rewrite_controller.iframes.length > 0){
  588. wsrp_rewrite_setFrameLocation(wsrp_rewrite_controller.iframes.pop());
  589. }
  590. wsrp_rewrite_setAuthenticated();
  591. }
  592. }
  593. <!--
  594. An object that will contain referent to the iframe and the href it should be set to
  595. -->
  596. function _F_CPSIFrame(iFrameId, url, doc){
  597. this.iFrameId = iFrameId;
  598. this.url = url;
  599. this.isLocationSet = false;
  600. this.doc=doc;
  601. }
  602. <!--
  603. A global variable used to store the portlet iframe wrapper. This will be used for browser resize action
  604. -->
  605. <xsl:if test="$viewer-resize='t'">
  606. var wsrp_rewrite_cpsFrame;
  607. </xsl:if>
  608. <!--
  609. Set the location of the iframe associated the the _F_CPSIFrame object
  610. -->
  611. function wsrp_rewrite_setFrameLocation(cpsFrame, overrideUrl){
  612. if(overrideUrl){
  613. cpsFrame.url = overrideUrl;
  614. }
  615. var iframe = cpsFrame.doc.getElementById(cpsFrame.iFrameId);
  616. <xsl:if test="$viewer-resize='t'">
  617. <!-- get rid off the cache string -->
  618. var index=cpsFrame.url.indexOf("m_session");
  619. if (index >-1){
  620. cpsFrame.url=cpsFrame.url.slice(0,index);
  621. }
  622. if(cpsFrame.url.indexOf("ui.action%3drun") >-1) {
  623. cpsFrame.url=cpsFrame.url.replace(/ui.action%3drun/,"ui.action%3dmodifyCMReport");
  624. cpsFrame.url+=wsrp_rewrite_cvReportChartResize(iframe) ;
  625. }
  626. </xsl:if>
  627. if (iframe != null){
  628. var _self = cpsFrame;
  629. setTimeout(function(){_self.isLocationSet = true; iframe.src = _self.url}, 1);
  630. }
  631. }
  632. <xsl:if test="$viewer-resize='t'">
  633. <!-- User define margin -->
  634. var wsrp_rewrite_chart_width_margin= 25;
  635. var wsrp_rewrite_chart_height_margin= 75;
  636. var wsrp_rewrite_chart_width = wsrp_rewrite_chart_width_margin;
  637. var wsrp_rewrite_chart_height = wsrp_rewrite_chart_height_margin;
  638. <!-- This function calculates the required size for iframe chart and return the string that needs to be part of the iframe src -->
  639. function wsrp_rewrite_cvReportChartResize(iframe) {
  640. wsrp_rewrite_chart_height = wsrp_rewrite_getChartHeight(iframe.offsetHeight, wsrp_rewrite_chart_height_margin);
  641. wsrp_rewrite_chart_width = wsrp_rewrite_getChartWidth(iframe.offsetWidth, wsrp_rewrite_chart_width_margin);
  642. return "%26cv.reportWidth=" + wsrp_rewrite_chart_width + "%26cv.reportHeight=" +wsrp_rewrite_chart_height;
  643. }
  644. function wsrp_rewrite_getChartHeight(iframeHeight, heightMargin) {
  645. if(iframeHeight > heightMargin ) {
  646. return iframeHeight - heightMargin;
  647. } else {
  648. return iframeHeight;
  649. }
  650. }
  651. function wsrp_rewrite_getChartWidth(iframeWidth, widthMargin) {
  652. if(iframeWidth > widthMargin ) {
  653. return iframeWidth - widthMargin;
  654. } else {
  655. return iframeWidth;
  656. }
  657. }
  658. <!--
  659. Browser resize event listener
  660. -->
  661. var wsrp_rewrite_timeoutWait;
  662. if (wsrp_rewrite_scope.attachEvent) {
  663. wsrp_rewrite_scope.attachEvent('onresize', function(event){
  664. clearTimeout(wsrp_rewrite_timeoutWait);
  665. wsrp_rewrite_timeoutWait = setTimeout('wsrp_rewrite_resizeIframe(wsrp_rewrite_cpsFrame)',1000);
  666. });;
  667. } else if (wsrp_rewrite_scope.addEventListener) {
  668. wsrp_rewrite_scope.addEventListener('resize', function(event){
  669. clearTimeout(wsrp_rewrite_timeoutWait);
  670. wsrp_rewrite_timeoutWait = setTimeout('wsrp_rewrite_resizeIframe(wsrp_rewrite_cpsFrame)',1000);
  671. });;
  672. }
  673. <!--
  674. Dragging portlet to another column will resize the chart if the iframe size changed
  675. -->
  676. Liferay.on('initLayout', function(event) {
  677. Liferay.once(function() {
  678. Liferay.Layout.on([ 'drag:end' ], function(event) {
  679. if(wsrp_rewrite_cpsFrame != null) {
  680. setTimeout('wsrp_rewrite_resizeIframe(wsrp_rewrite_cpsFrame)',1);
  681. }
  682. });
  683. }, Liferay.Layout, 'bindDragDropListeners');
  684. });
  685. <!--
  686. This function resizes the chart in the report if the iframe size is changed
  687. -->
  688. function wsrp_rewrite_resizeIframe(cpsFrame) {
  689. if(cpsFrame != null) {
  690. var iframe = cpsFrame.doc.getElementById(cpsFrame.iFrameId);
  691. if(cpsFrame.url.indexOf("ui.action%3dmodifyCMReport") >-1) {
  692. if (wsrp_rewrite_chart_width != wsrp_rewrite_getChartWidth(iframe.offsetWidth, wsrp_rewrite_chart_width_margin) || wsrp_rewrite_chart_height != wsrp_rewrite_getChartHeight(iframe.offsetHeight, wsrp_rewrite_chart_height_margin) ){
  693. iframe.src=cpsFrame.url.replace(/%26cv.reportWidth=([0-9][0-9]{0,3})%26cv.reportHeight=([0-9][0-9]{0,3})/,wsrp_rewrite_cvReportChartResize(iframe));
  694. }
  695. }
  696. }
  697. }
  698. </xsl:if>
  699. <!--
  700. Called when the iframe is loaded.
  701. This might be called multiple times because the iframe onLoad event might be triggered when the href is about:blank.
  702. This method will notify the controller when the content is loaded.
  703. -->
  704. function wsrp_rewrite_setReady(iFrameWrapper){
  705. if (iFrameWrapper &amp;&amp; iFrameWrapper.isLocationSet){
  706. <xsl:if test="$consumerAgent = 'sharepoint'">
  707. <!-- for collaboration, we need to get the session information so we when publish reports, we use the cloned user session -->
  708. if(!wsrp_rewrite_controller.isClearingCookie &amp;&amp; !wsrp_rewrite_controller.sessionInfoRequested){
  709. wsrp_rewrite_controller.sessionInfoRequested = true;
  710. document.getElementById("wsrp_rewrite_getsession").src = wsrp_rewrite_getGetSessionUrl();
  711. }
  712. </xsl:if>
  713. wsrp_rewrite_notifyController();
  714. }
  715. }
  716. <!--
  717. If the iframe controller is not created, we will create it. The name of the controller will contain the registration id of the producer.
  718. If we have mulitple viewers on the page with different registration ids, they will use different controllers.
  719. This is needed to be able to support multiple viewer coming from different versions
  720. -->
  721. if (!wsrp_rewrite_scope._F_CPSIFrameControllerDefined_<xsl:value-of select="$portlet-op/wsrp:registrationContext/wsrp:registrationHandle"/>){
  722. wsrp_rewrite_scope._F_CPSIFrameControllerDefined_<xsl:value-of select="$portlet-op/wsrp:registrationContext/wsrp:registrationHandle"/> = true;
  723. wsrp_rewrite_scope._F_CPSIFrameControllerInstance_<xsl:value-of select="$portlet-op/wsrp:registrationContext/wsrp:registrationHandle"/> = new _F_CPSIFrameController();
  724. }
  725. var wsrp_rewrite_controller = wsrp_rewrite_scope._F_CPSIFrameControllerInstance_<xsl:value-of select="$portlet-op/wsrp:registrationContext/wsrp:registrationHandle"/>;
  726. <!--
  727. If we reAuthenticated, tell the iframe controller to clean the cookie by submitting
  728. a request that will trigger the loging page causing the passport cookie to reset
  729. -->
  730. wsrp_rewrite_controller.clearCookie = wsrp_rewrite_isReAuthenticated();
  731. </script>
  732. <xsl:if test="$consumerAgent = 'sharepoint'">
  733. <!-- Add sharepoint specific collaboration code -->
  734. <script language="javascript" src="{$ui-webcontent}cps4/cpsweb/cpsweb.js"/>
  735. <script language="javascript" src="{$ui-webcontent}cps4/cpsweb/sp/collaboration.js"/>
  736. <script language="javascript">
  737. <!--
  738. ApplicationContent parameters. A list of parameters that are need by the collaboration feature.
  739. -->
  740. var wsrp_rewrite_params = {
  741. publishSpec:"<xsl:value-of select="xtsext:javascriptencode($publish-spec)"/>",
  742. discussionSpec:"<xsl:value-of select="xtsext:javascriptencode($discussion-spec)"/>",
  743. objectUrl: "<xsl:value-of select="xtsext:javascriptencode($url-item)"/>",
  744. publishWithoutPrompt:"<xsl:value-of select="xtsext:javascriptencode($publish-no-prompt)"/>",
  745. reportStoreId:"<xsl:value-of select="xtsext:javascriptencode($item/nav:internalId)"/>",
  746. searchPath:"<xsl:value-of select="xtsext:javascriptencode($item/nav:searchPath)"/>",
  747. sessionId:"<xsl:value-of select="xtsext:javascriptencode($session-id-param)"/>",
  748. canRun: <xsl:value-of select="boolean($is-dashboard or not($canView) or $display-action='run' or $display-action='prompt')"/>
  749. };
  750. var wsrp_rewrite_messages = {
  751. 'IDS_SP_ERROR_LABEL' :'<xts:string id="IDS_SP_ERROR_LABEL" encode="javascript"/>',
  752. 'IDS_SP_DOCUMENT_NAME_LABEL' :'<xts:string id="IDS_SP_DOCUMENT_NAME_LABEL" encode="javascript"/>',
  753. 'IDS_SP_DOCUMENT_NAME_TOOLTIP' :'<xts:string id="IDS_SP_DOCUMENT_NAME_TOOLTIP" encode="javascript"/>',
  754. 'IDS_SP_YES' :'<xts:string id="IDS_SP_YES" encode="javascript"/>',
  755. 'IDS_SP_NO' :'<xts:string id="IDS_SP_NO" encode="javascript"/>',
  756. 'IDS_SP_OK' :'<xts:string id="IDS_SP_OK" encode="javascript"/>',
  757. 'IDS_SP_CANCEL' :'<xts:string id="IDS_SP_CANCEL" encode="javascript"/>',
  758. 'IDS_SP_OBJECT_TYPE_SITE' :'<xts:string id="IDS_SP_OBJECT_TYPE_SITE" encode="javascript"/>',
  759. 'IDS_SP_OBJECT_TYPE_FOLDER' :'<xts:string id="IDS_SP_OBJECT_TYPE_FOLDER" encode="javascript"/>',
  760. 'IDS_SP_OBJECT_TYPE_DOCUMENT_LIBRARY' :'<xts:string id="IDS_SP_OBJECT_TYPE_DOCUMENT_LIBRARY" encode="javascript"/>',
  761. 'IDS_SP_OBJECT_TYPE_DISCUSSION_LIST' :'<xts:string id="IDS_SP_OBJECT_TYPE_DISCUSSION_LIST" encode="javascript"/>',
  762. 'IDS_SP_EDT_SELECT_DLG_DISCUSSION_TITLE' :'<xts:string id="IDS_SP_EDT_SELECT_DLG_DISCUSSION_TITLE" encode="javascript"/>',
  763. 'IDS_SP_EDT_SELECT_DLG_PUBLISH_TITLE' :'<xts:string id="IDS_SP_EDT_SELECT_DLG_PUBLISH_TITLE" encode="javascript"/>',
  764. 'IDS_SP_EDT_SELECT_DLG_LOCATION_TITLE':'<xts:string id="IDS_SP_EDT_SELECT_DLG_PUBLISH_LOCATION_TITLE" encode="javascript"/>',
  765. 'IDS_SP_MENU_RUN_PUBLISH' :'<xts:string id="IDS_SP_MENU_RUN_PUBLISH" encode="javascript"/>',
  766. 'IDS_SP_MENU_VERSIONS' :'<xts:string id="IDS_SP_MENU_VERSIONS" encode="javascript"/>',
  767. 'IDS_SP_RUNNING_REPORT' :'<xts:string id="IDS_SP_RUNNING_REPORT" encode="javascript"/>',
  768. 'IDS_SP_CANNOT_RUN_REPORT' :'<xts:string id="IDS_SP_CANNOT_RUN_REPORT" encode="javascript"/>',
  769. "IDS_SP_DOCUMENT_PUBLISHED": "<xts:string id="IDS_SP_DOCUMENT_PUBLISHED" encode="javascript"><xts:param name="doc">$1</xts:param><xts:param name="doclib">$2</xts:param></xts:string>",
  770. 'IDS_SP_DISCUSSION_STARTED' :'<xts:string id="IDS_SP_DISCUSSION_STARTED" encode="javascript"/>',
  771. 'IDS_SP_DISCUSSION_BODY' :'<xts:string id="IDS_SP_DISCUSSION_BODY" encode="javascript"><xts:param name="title">$1</xts:param></xts:string>',
  772. 'IDS_SP_VIEW_DOCUMENT_ALT' :'<xts:string id="IDS_SP_VIEW_DOCUMENT_ALT" encode="javascript"/>',
  773. 'IDS_SP_VIEW_DOCUMENT_LIBRARY_ALT' :'<xts:string id="IDS_SP_VIEW_DOCUMENT_LIBRARY_ALT" encode="javascript"/>',
  774. 'IDS_SP_MENU_DISCUSS_START' :'<xts:string id="IDS_SP_MENU_DISCUSS_START" encode="javascript"/>',
  775. 'IDS_SP_MENU_DISCUSS_SHOW_RELATED' :'<xts:string id="IDS_SP_MENU_DISCUSS_SHOW_RELATED" encode="javascript"/>',
  776. 'IDS_SP_DOCUMENT_PUBLISH_EXISTS':'<xts:string id="IDS_SP_DOCUMENT_PUBLISH_EXISTS" encode="javascript"><xts:param name="doc">$1</xts:param></xts:string>',
  777. 'IDS_SP_DOCUMENT_PUBLISH_EXISTS_HINT':'<xts:string id="IDS_SP_DOCUMENT_PUBLISH_EXISTS_HINT" encode="javascript"><xts:param name="doc">$1</xts:param></xts:string>',
  778. 'IDS_SP_ERROR_SESSION_EXPIRED':'<xts:string id="IDS_SP_ERROR_SESSION_EXPIRED" encode="javascript"></xts:string>',
  779. 'IDS_SP_PUBLISH_NO_SESSION':'<xts:string id="IDS_SP_PUBLISH_NO_SESSION" encode="javascript"></xts:string>',
  780. 'IDS_SP_PUBLISH_MISSING_PROMPTS':'<xts:string id="IDS_SP_PUBLISH_MISSING_PROMPTS" encode="javascript"></xts:string>',
  781. 'IDS_SP_ERROR_CLEAR':'<xts:string id="IDS_SP_ERROR_CLEAR" encode="javascript"></xts:string>'
  782. };
  783. var wsrp_rewrite_gateway = "<xsl:value-of select="xtsext:javascriptencode($ui-gateway)"/>";
  784. var wsrp_rewrite_webcontent = "<xsl:value-of select="xtsext:javascriptencode($ui-webcontent)"/>";
  785. var wsrp_rewrite_contentLocale = "<xsl:value-of select="xtsext:javascriptencode(/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/*[local-name()='biBusHeader']/*[local-name()='userPreferenceVars']/item[name='contentLocale']/value)"/>";
  786. var wsrp_rewrite_productLocale = "<xsl:value-of select="xtsext:javascriptencode(/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/*[local-name()='biBusHeader']/*[local-name()='userPreferenceVars']/item[name='productLocale']/value)"/>";
  787. <!-- Create the application context and the colloraboration objects -->
  788. <![CDATA[
  789. var wsrp_rewrite_app;
  790. var wsrp_rewrite_appContext = new com_ibm_cognos_cps.ApplicationContext({
  791. proxyTemplate:(new Object().href="wsrp_rewrite?wsrp-urlType=resource&wsrp-requiresRewrite=true&wsrp-url=_cpsresourceurl%3Acpsendmarker_/wsrp_rewrite"),
  792. renderUrl:(new Object().href="wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite"),
  793. gateway:wsrp_rewrite_gateway,
  794. webcontent:wsrp_rewrite_webcontent,
  795. contentLocale: wsrp_rewrite_contentLocale,
  796. productLocale:wsrp_rewrite_productLocale,
  797. parameters: wsrp_rewrite_params,
  798. sessionController: wsrp_rewrite_controller
  799. });
  800. function wsrp_rewrite_getGetSessionUrl(){
  801. var target = wsrp_rewrite_gateway + "?" + "b_action=xts.run&m=cps4/common/getsession.xts&context=wsrp_rewrite_controller";
  802. return wsrp_rewrite_gateway + "?" + "b_action=xts.run&m=cps4/common/getsession.xts&target=" + encodeURIComponent(wsrp_rewrite_appContext.getProxiedResource(target));
  803. }
  804. com_ibm_cognos_cps.sp.executeWhenLoaded( function(){
  805. wsrp_rewrite_app = new com_ibm_cognos_cps.sp.CPSCollaboration (wsrp_rewrite_appContext, "wsrp_rewrite_app", wsrp_rewrite_messages);
  806. });
  807. ]]>
  808. </script>
  809. <iframe frameborder="0" scrolling="auto" id="wsrp_rewrite_getsession" style="display:none">
  810. </iframe>
  811. </xsl:if>
  812. <iframe onload="wsrp_rewrite_setReady(window.wsrp_rewrite_loginIframeWrapper)" frameborder="0" scrolling="auto" id="wsrp_rewrite_clearcookie" style="display:none">
  813. </iframe>
  814. </xsl:when>
  815. <xsl:otherwise>
  816. <script language="javascript">
  817. var wsrp_rewrite_frameloaded = false;
  818. function wsrp_rewrite_loadframe(){
  819. if (!wsrp_rewrite_frameloaded){
  820. var parentFrame = self;
  821. while(parentFrame != top){
  822. try{
  823. if (parentFrame.name != null){
  824. if (parentFrame.name.indexOf("<xsl:value-of select="$display-id"/>") != -1){
  825. var oDiv = document.getElementById("wsrp_rewrite_eholder");
  826. oDiv.style.display = "block";
  827. var oIFrame = document.getElementById("wsrp_rewrite_iframe");
  828. oIFrame.style.display = "none";
  829. wsrp_rewrite_frameloaded=true;
  830. return;
  831. }
  832. }
  833. }
  834. catch (e){
  835. }
  836. parentFrame= parentFrame.parent;
  837. }
  838. var oIFrame = document.getElementById("wsrp_rewrite_iframe");
  839. oIFrame.src= "<xsl:value-of select="xtsext:javascriptencode($url)"/>";
  840. wsrp_rewrite_frameloaded=true;
  841. }
  842. }
  843. </script>
  844. <div id="wsrp_rewrite_eholder" style="display:none;">
  845. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  846. <tr>
  847. <td class="portlet-font" align="center" valign="middle" height="100" id="wsrp_rewrite_error_txt">
  848. <xts:string id="IDS_NAV_VEW_RECURSIVE_CALL_ERROR"/>
  849. <br/><xts:string id="IDS_NAV_VEW_CONTACT_ADMINISTRATOR"/><br/>
  850. </td>
  851. </tr>
  852. </table>
  853. </div>
  854. </xsl:otherwise>
  855. </xsl:choose>
  856. <xsl:variable name="calculated-width">
  857. <xsl:choose>
  858. <xsl:when test="$display-width!=''">
  859. <xsl:value-of select="$display-width"/>
  860. </xsl:when>
  861. <xsl:otherwise>100%</xsl:otherwise>
  862. </xsl:choose>
  863. </xsl:variable>
  864. <xsl:if test="not($is-external) and not($is-dashboard)">
  865. <script language="javascript">
  866. function wsrp_rewrite_showframe(){
  867. var oDiv = document.getElementById("wsrp_rewrite_busydiv");
  868. if (oDiv) {
  869. oDiv.style.display = "none";
  870. }
  871. }
  872. </script>
  873. <xsl:variable name="busydiv-style">
  874. <xsl:text>position:relative</xsl:text>
  875. <xsl:if test="$show-run-action">;display:none;</xsl:if>
  876. </xsl:variable>
  877. <div style="{$busydiv-style}" id="wsrp_rewrite_busydiv">
  878. <div style="text-align:center; position:absolute; padding:5px; left:45%">
  879. <img border="0" src="{ $ui-producer-images }progress.gif"/>
  880. <br/>
  881. <xts:string id="IDS_SEARCH_INDEXTREE_LOADING"/>
  882. </div>
  883. </div>
  884. </xsl:if>
  885. <iframe frameborder="0" scrolling="auto" id="wsrp_rewrite_iframe">
  886. <xsl:attribute name="width">
  887. <xsl:value-of select="$calculated-width"/>
  888. </xsl:attribute>
  889. <xsl:if test="$display-height!='' and $ui-window-state != 'wsrp:maximized'">
  890. <xsl:attribute name="height"><xsl:value-of select="$display-height"/></xsl:attribute>
  891. </xsl:if>
  892. <xsl:if test="$hidden = true()">
  893. <xsl:attribute name="style">display:none;</xsl:attribute>
  894. </xsl:if>
  895. <xsl:choose>
  896. <xsl:when test="$is-external">
  897. <xsl:attribute name="name">wsrp_rewrite_<xsl:value-of select="$display-id"/></xsl:attribute>
  898. <xsl:attribute name="src"><xsl:value-of select="$iFrameSrc"/></xsl:attribute>
  899. <xsl:attribute name="onload">wsrp_rewrite_loadframe()</xsl:attribute>
  900. </xsl:when>
  901. <xsl:when test="$third-party-portal">
  902. <xsl:attribute name="src">about:blank</xsl:attribute>
  903. <xsl:attribute name="onload">
  904. <xsl:text>wsrp_rewrite_setReady(window.wsrp_rewrite_iframeWrapper);</xsl:text>
  905. <xsl:if test="not($is-dashboard)">
  906. <xsl:text>if (window.wsrp_rewrite_iframeWrapper &amp;&amp; wsrp_rewrite_iframeWrapper.isLocationSet) wsrp_rewrite_showframe();</xsl:text>
  907. </xsl:if>
  908. </xsl:attribute>
  909. </xsl:when>
  910. <xsl:otherwise>
  911. <xsl:attribute name="src"><xsl:value-of select="$url"/></xsl:attribute>
  912. <xsl:if test="not($is-dashboard)">
  913. <xsl:attribute name="onload">wsrp_rewrite_showframe();</xsl:attribute>
  914. </xsl:if>
  915. </xsl:otherwise>
  916. </xsl:choose>
  917. </iframe>
  918. <xsl:if test="$consumerAgent = 'sharepoint'">
  919. <div id="wsrp_rewrite_app.id.toolbar" style="text-align:left; border-top:1px solid #ebebeb; padding:10px;margin-top:5px; display: none;">
  920. <a href="#" style="display:none" id="wsrp_rewrite_app.id.publish_menulink" onclick="setTimeout('wsrp_rewrite_app.publishMenuClick()',10);return false;"><xts:string id="IDS_SP_MENU_PUBLISH"/></a>
  921. <a href="#" style="margin-left:10px; display:none" id="wsrp_rewrite_app.id.discuss_menulink" onclick="setTimeout('wsrp_rewrite_app.discussMenuClick()',10);return false;"><xts:string id="IDS_SP_MENU_DISCUSS"/></a>
  922. </div>
  923. </xsl:if>
  924. <xsl:if test="not($is-external) and $third-party-portal">
  925. <script language="javascript">
  926. // register the iframeWrapper
  927. var wsrp_rewrite_iframeWrapper = new _F_CPSIFrame("wsrp_rewrite_iframe", "<xsl:value-of select="xtsext:javascriptencode($url)"/>", document);
  928. <!-- we only synchronize the iframe when we don't have the run option is not set to "prompt" -->
  929. <xsl:if test="not($show-run-action)">
  930. <xsl:choose>
  931. <xsl:when test="$viewer-resize='t'">
  932. <xsl:if test="$viewer-resize='t'">
  933. wsrp_rewrite_cpsFrame=wsrp_rewrite_iframeWrapper;
  934. </xsl:if>
  935. <!-- This may not work if browser is very slow -->
  936. setTimeout('wsrp_rewrite_addFrameToController(wsrp_rewrite_iframeWrapper)', 1000);
  937. </xsl:when>
  938. <xsl:otherwise>
  939. wsrp_rewrite_addFrameToController(wsrp_rewrite_iframeWrapper);
  940. </xsl:otherwise>
  941. </xsl:choose>
  942. </xsl:if>
  943. </script>
  944. </xsl:if>
  945. <ui:maximize-scripts ui:objectId="wsrp_rewrite_iframe"/>
  946. </xsl:template>
  947. </xsl:stylesheet>