configuration.xslt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  15. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  16. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  17. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  18. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  19. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  20. xmlns:dc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/confirm/1/"
  21. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  22. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  23. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  24. xmlns:out="dummy-uri"
  25. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  26. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  27. xmlns:mvc="http://developer.cognos.com/schemas/xts/mvc">
  28. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  29. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  30. <xsl:template match="mvc:launchable">
  31. <xsl:variable name="mode" select="@mode"/>
  32. <!-- starting folder -->
  33. <out:variable name="startingFolder">
  34. <out:choose>
  35. <out:when test="string(/root/env/param[@name='so.searchPath2']) != ''">
  36. <out:value-of select="/root/env/param[@name='so.searchPath2']"/>
  37. </out:when>
  38. <out:when test="string(/root/env/param[@name='m_p_RCRstartingFolder']) != ''">
  39. <out:value-of select="/root/env/param[@name='m_p_RCRstartingFolder']"/>
  40. </out:when>
  41. <out:when test="/root/*[local-name()='specification']/*[local-name()='param'][@name='startingFolder']">
  42. <out:value-of select="/root/*[local-name()='specification']/*[local-name()='param'][@name='startingFolder']"/>
  43. </out:when>
  44. </out:choose>
  45. </out:variable>
  46. <script language="javascript">
  47. var startingFolder = "<out:value-of select="xtsext:javascriptencode($startingFolder)"/>";
  48. function browse() {
  49. var f = document.createElement("form");
  50. f.setAttribute("name", "browseForm");
  51. f.setAttribute("action", "<out:value-of select="xtsext:javascriptencode($mvc-remote-gateway)"/>");
  52. f.setAttribute("method", "POST");
  53. var paramArray = {
  54. "b_action" : "xts.run",
  55. "m" : "portal/select/select.xts",
  56. "so.return.gateway" : "<out:value-of select="xtsext:javascriptencode(string(/root/configProps/param[@name='cps']/property[@name='gateway']))"/>",
  57. "so.return.m" : "<out:value-of select="concat($app, '/', $mname)"/>",
  58. "so.select" : "remote_content",
  59. "so.defaultLocation" : document.pform.m_p_RCRstartingFolder.value
  60. };
  61. for (j in paramArray) {
  62. var input = document.createElement("input");
  63. input.setAttribute("type", "hidden");
  64. input.setAttribute("name", j);
  65. input.setAttribute("value", paramArray[j]);
  66. f.appendChild(input);
  67. }
  68. var packedEnv = document.createElement("input");
  69. packedEnv.setAttribute("type", "hidden");
  70. packedEnv.setAttribute("name", "packed-remoteBrowseEnv");
  71. packedEnv.setAttribute("value", '<out:value-of select="xtsext:javascriptencode(/root/packed-remoteBrowseEnv)"/>');
  72. f.appendChild(packedEnv);
  73. document.body.appendChild(f);
  74. f.submit();
  75. document.body.removeChild(f);
  76. f = null;
  77. }
  78. function validate() {
  79. if (startingFolder == '') {
  80. alert("<xts:string id="IDS_PROP_ERR_MVC_NO_STARTINGFOLDER" encode="javascript"/>");
  81. return false;
  82. }
  83. return true;
  84. }
  85. </script>
  86. <out:variable name="launchableType">
  87. <out:choose>
  88. <out:when test="/root/env/param[@name='m_p_launchableType'] != ''">
  89. <out:value-of select="/root/env/param[@name='m_p_launchableType']"/>
  90. </out:when>
  91. <xsl:if test="$mode = 'properties'">
  92. <out:when test="$obj/cm:launchableType">
  93. <out:value-of select="$obj/cm:launchableType"/>
  94. </out:when>
  95. </xsl:if>
  96. <out:otherwise>
  97. <out:text/>application/vnd.ibm.cognos.instance<out:text/>
  98. </out:otherwise>
  99. </out:choose>
  100. </out:variable>
  101. <dp:description>
  102. <xts:string id="IDS_MVC_LAUNCHABLE_INTRO"/>
  103. </dp:description>
  104. <lyt:layout style="1">
  105. <lyt:section>
  106. </lyt:section>
  107. <lyt:section>
  108. <utml:input name="m_p_launchableType" value="application/vnd.ibm.cognos.instance" type="hidden"/>
  109. <dp:list>
  110. <dp:section>
  111. <dp:label><xts:string id="IDS_MVC_LAUNCHABLE_STARTINGFOLDER"/></dp:label>
  112. </dp:section>
  113. <dp:section wrap="wrap">
  114. <div>
  115. <out:choose>
  116. <out:when test="$startingFolder != ''">
  117. <span><out:value-of select="$startingFolder"/></span>
  118. </out:when>
  119. <out:otherwise>
  120. <dp:inactiveText><i><xts:string id="IDS_NONE"/></i>&#160;&#160;</dp:inactiveText>
  121. </out:otherwise>
  122. </out:choose>
  123. <input type="hidden" name="m_p_RCRstartingFolder" value="{'{$startingFolder}'}"/>
  124. </div>
  125. </dp:section>
  126. <dp:section>
  127. <!-- Browse button to select a starting folder -->
  128. <out:if test="not($readOnly)">
  129. <a href="javascript:browse();">
  130. <xts:string id="IDS_MVC_LAUNCHABLE_STARTINGFOLDER_BROWSE"/>
  131. </a>
  132. </out:if>
  133. </dp:section>
  134. </dp:list>
  135. </lyt:section>
  136. </lyt:layout>
  137. </xsl:template>
  138. <!-- MVC - template to render the UI to prompt user to link to their remote My Folder contents -->
  139. <xsl:template match="mvc:remotePersonalRCRCreation">
  140. <div id="id_mvcPersonalRCR" style="display:none;position:absolute;z-index:33" height="0" width="0">
  141. <out:attribute name="onclick">
  142. <out:choose>
  143. <out:when test="$browser = 'ie'">event.cancelBubble='true';</out:when>
  144. <out:otherwise>event.stopPropagation();</out:otherwise>
  145. </out:choose>
  146. </out:attribute>
  147. <table border="0" width="1px" cellpadding="0" cellspacing="0">
  148. <tr>
  149. <td>
  150. <table border="0" width="100%" cellpadding="0" cellspacing="0" class="dialogHeader">
  151. <tr>
  152. <td width="100%" valign="middle">
  153. <span class="dialogHeaderTitle"><xts:string id="IDS_MVC_CONTENT_REFERENCE_REMOTEMYFOLDER_NAME"/></span>
  154. </td>
  155. <td valign="middle" class="dialogHeaderLink">
  156. <a class="dialogHeaderLinkColor" href="javascript:help()" onmouseover="window.status='';return true;" onmouseout="window.status='';return true;"><xts:string id="IDS_HELP"/></a>
  157. </td>
  158. <td valign="middle" style="padding-right:3px;">
  159. <a id="IDS_CLOSE" href="#" onclick="javascript:mvcClosePersonalRCRDialog();" onmouseover="window.status='';return true;" onmouseout="window.status='';return true;">
  160. <img height="16" width="16" border="0" src="{'{$skin_images}'}close.gif" class="dialogClose" onmouseover="this.className = 'dialogCloseOver'" onmouseout="this.className = 'dialogClose'" onmouseup="this.className = 'dialogClose'" title="Close"/>
  161. </a>
  162. </td>
  163. </tr>
  164. </table>
  165. <table border="0" width="100%" cellpadding="0" cellspacing="0" class="dialogWindowPopup">
  166. <tr>
  167. <td colspan="2" class="body_dialog_modal" align="left">
  168. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  169. <tr>
  170. <td height="10" width="100%">
  171. <img alt="" title="" height="10" width="1" src="{'{$webcontent}'}/images/space.gif"/>
  172. </td>
  173. </tr>
  174. </table>
  175. <table border="0" cellspacing="0" cellpadding="3" width="100%">
  176. <tr>
  177. <td height="1" width="1">
  178. <img alt="" title="" width="1" height="1" src="{'{$webcontent}'}/images/space.gif"/>
  179. </td>
  180. <td width="100%">
  181. <table border="0" cellspacing="0" cellpadding="1">
  182. <tr>
  183. <td class="formText"><xts:string id="IDS_MVC_CONTENT_REFERENCE_REMOTEMYFOLDER_DESC"/></td>
  184. </tr>
  185. <tr>
  186. <td class="formText">&#160;</td>
  187. </tr>
  188. <tr>
  189. <td class="formText">
  190. <table border="0" cellspacing="0" cellpadding="1">
  191. <tr>
  192. <td class="formLabel"><xts:string id="IDS_NEW_NAME"/></td>
  193. </tr>
  194. <tr>
  195. <td class="formText">
  196. <script language="javascript"/>
  197. <form name="mvcForm">
  198. <input type="text" name="mvc_name" value="" size="70" maxlength="256">
  199. <out:attribute name="onkeypress">
  200. <out:text/>if (event.keyCode == 13) {return mvcCreatePersonalRCREntry();} else if (event.keyCode == 27) {mvcClosePersonalRCRDialog(); return false;}<out:text/>
  201. </out:attribute>
  202. </input>
  203. </form>
  204. </td>
  205. </tr>
  206. <tr>
  207. <td>
  208. <img alt="" title="" height="5" width="1" src="{'{$webcontent}'}/images/space.gif"/>
  209. </td>
  210. </tr>
  211. </table>
  212. </td>
  213. </tr>
  214. </table>
  215. </td>
  216. </tr>
  217. </table>
  218. </td>
  219. </tr>
  220. </table>
  221. <table width="100%" border="0" cellpadding="0" cellspacing="0" class="dialogButtonBar">
  222. <tr>
  223. <td width="2" valign="middle">
  224. <img alt="" title="" width="2" src="{'{$webcontent}'}/images/space.gif"/>
  225. </td>
  226. <td valign="middle">
  227. <table border="0" cellpadding="1" cellspacing="0">
  228. <tr>
  229. <td>
  230. <table cellpadding="0" cellspacing="0" onmouseover="this.className = 'commandButtonOver'" onmouseout="this.className = 'commandButton'" onmousedown="this.className = 'commandButtonDown'" class="commandButton" style="padding-right:10px; padding-left:10px; padding-top:2px; padding-bottom:3px;">
  231. <tr>
  232. <td valign="middle" align="center" id="btnAnchorWide">
  233. <a id="IDS_OK" href="#" onclick="return mvcCreatePersonalRCREntry();" onmouseover="window.status='';return true;" onmouseout="window.status='';return true;"><xts:string id="IDS_OK"/></a>
  234. </td>
  235. </tr>
  236. </table>
  237. </td>
  238. <td>
  239. <img alt="" title="" height="1" width="10" src="{'{$webcontent}'}/images/space.gif"/>
  240. </td>
  241. <td>
  242. <table cellpadding="0" cellspacing="0" onmouseover="this.className = 'commandButtonOver'" onmouseout="this.className = 'commandButton'" onmousedown="this.className = 'commandButtonDown'" class="commandButton" style="padding-right:10px; padding-left:10px; padding-top:2px; padding-bottom:3px;">
  243. <tr>
  244. <td valign="middle" align="center" id="btnAnchor">
  245. <a id="IDS_CANCEL" href="#" onclick="javascript:mvcCancelPersonalRCRDialog();" onmouseover="window.status='';return true;" onmouseout="window.status='';return true;"><xts:string id="IDS_CANCEL"/></a>
  246. </td>
  247. </tr>
  248. </table>
  249. </td>
  250. <td>
  251. <img alt="" title="" height="1" width="10" src="{'{$webcontent}'}/images/space.gif"/>
  252. </td>
  253. </tr>
  254. </table>
  255. </td>
  256. <td width="100%"></td>
  257. </tr>
  258. </table>
  259. </td>
  260. </tr>
  261. </table>
  262. </div>
  263. <script language="javascript">
  264. function getPersonalRCRContainer() {
  265. return document.getElementById('id_mvcPersonalRCR');
  266. }
  267. function mvcCancelPersonalRCRDialog() {
  268. mvcClosePersonalRCRDialog();
  269. }
  270. function mvcClosePersonalRCRDialog() {
  271. getPersonalRCRContainer().style.display = "none";
  272. }
  273. function mvcSetFocus() {
  274. document.mvcForm.mvc_name.focus();
  275. }
  276. function validate() {
  277. if (document.mvcForm.mvc_name.value == '') {
  278. <out:variable name="errmsg">
  279. <out:variable name="label"><xts:string id="IDS_NEW_NAME" encode="javascript"/></out:variable>
  280. <xts:string id="IDS_ERR_MANDATORY" encode="javascript">
  281. <xts:param name="field"><out:value-of select="$label"/></xts:param>
  282. </xts:string>
  283. </out:variable>
  284. alert("<out:value-of select="$errmsg"/>");
  285. mvcSetFocus();
  286. return false;
  287. }
  288. return true;
  289. }
  290. function mvcCreatePersonalRCREntry() {
  291. if (validate()) {
  292. var cmdForm = document.<out:value-of select="$cmd-form"/>;
  293. cmdForm.m.value = "<out:value-of select="$app"/>/submit.xts";
  294. cmdForm.ifrmcmd.value = "create";
  295. cmdForm.m_obj.value = "~/folder";
  296. cmdForm.m_class.value = "launchable";
  297. cmdForm.backURL.value = "<out:value-of select="xtsext:javascriptencode(string($back-url))"/>";
  298. cmdForm.m_new_class.value = "launchable";
  299. var input = document.createElement("input");
  300. input.setAttribute("type", "hidden");
  301. input.setAttribute("name", "m_p_RCRstartingFolder");
  302. input.setAttribute("value", "~/folder");
  303. cmdForm.appendChild(input);
  304. input = document.createElement("input");
  305. input.setAttribute("type", "hidden");
  306. input.setAttribute("name", "m_p_launchableType");
  307. input.setAttribute("value", "application/vnd.ibm.cognos.instance");
  308. cmdForm.appendChild(input);
  309. input = document.createElement("input");
  310. input.setAttribute("type", "hidden");
  311. input.setAttribute("name", "m_p_defaultName");
  312. input.setAttribute("value", document.mvcForm.mvc_name.value);
  313. cmdForm.appendChild(input);
  314. cmdForm.submit();
  315. }
  316. return false;
  317. }
  318. function mvcShowPersonalRCRDialog() {
  319. var div = getPersonalRCRContainer();
  320. if (div != null) {
  321. div.style.display = "";
  322. mvcResizePersonalRCRDialog();
  323. mvcSetFocus();
  324. }
  325. }
  326. function mvcResizePersonalRCRDialog() {
  327. var div = getPersonalRCRContainer();
  328. div.style.top = (document.body.clientHeight - div.offsetHeight) * 0.35;
  329. div.style.left = (document.body.clientWidth - div.offsetWidth) / 2;
  330. }
  331. <!-- Register to close the dialog -->
  332. if (document.addEventListener) {
  333. document.addEventListener("click", mvcClosePersonalRCRDialog, false);
  334. } else if (document.attachEvent) {
  335. document.attachEvent("onclick", mvcClosePersonalRCRDialog);
  336. }
  337. <!-- Register to resize the dialog -->
  338. if (document.addEventListener) {
  339. window.addEventListener("resize", mvcResizePersonalRCRDialog, false);
  340. } else if (document.attachEvent) {
  341. window.attachEvent("onresize", mvcResizePersonalRCRDialog);
  342. }
  343. </script>
  344. </xsl:template>
  345. <xsl:template match="mvc:build-specification-xml">
  346. <out:template name="build-specification-xml">
  347. <out:param name="gateway" select="''"/>
  348. <out:param name="webcontent" select="''"/>
  349. <out:param name="startingFolder" select="''"/>
  350. <out:variable name="version" select="'1.0'"/>
  351. <out:variable name="specification">
  352. <specification version="{'{$version}'}">
  353. <param name="gateway"><out:value-of select="$gateway"/></param>
  354. <param name="webcontent"><out:value-of select="$webcontent"/></param>
  355. <param name="startingFolder"><out:value-of select="$startingFolder"/></param>
  356. </specification>
  357. </out:variable>
  358. <out:variable name="specification-encoded">
  359. <out:call-template name="serialize-xml">
  360. <out:with-param name="node-set" select="$specification"/>
  361. </out:call-template>
  362. </out:variable>
  363. <out:value-of select="$specification-encoded"/>
  364. </out:template>
  365. </xsl:template>
  366. <xsl:template match="*">
  367. <xsl:copy>
  368. <xsl:copy-of select="@*"/>
  369. <xsl:apply-templates/>
  370. </xsl:copy>
  371. </xsl:template>
  372. </xsl:stylesheet>