portal-ui.xslt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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, 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:out="dummy-uri"
  15. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  16. xmlns:pui="http://developer.cognos.com/common/portal/logic/ui/1/"
  17. xmlns:layout="http://developer.cognos.com/common/layout"
  18. exclude-result-prefixes="xts pui layout">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  21. <xsl:template match="pui:helplink">
  22. <layout:link href="#" onclick="_THIS_doHelp(false);return false;"><xts:string id="IDS_PROP_HELP_LINK"/></layout:link>
  23. </xsl:template>
  24. <xsl:template match="pui:aboutlink">
  25. <layout:link href="#" onclick="_THIS_doAbout();return false;"><xts:string id="IDS_PROP_ABOUT_LINK"/></layout:link>
  26. </xsl:template>
  27. <xsl:template match="pui:helpscript">
  28. <out:variable name="pui-locale" select="/root/preferences/param[@name='productLocale']"/>
  29. <out:variable name="pui-book" select="/root/input[@name='help']/help/book"/>
  30. <out:variable name="pui-helpIdRoot" select=" /root/input[@name='help']/help/helpIdRoot"/>
  31. <out:variable name="context">
  32. <out:value-of select="translate( $pui-helpIdRoot, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' )"/>
  33. </out:variable>
  34. <script type="text/javascript">
  35. function _THIS_doHelp(redirect)
  36. {
  37. var help_bookFile="<out:value-of select="$pui-book"/>";
  38. if (help_bookFile == "") {
  39. help_bookFile = _F_Config.help.book;
  40. }
  41. help_bookFile += ".html";
  42. var ui_help = null;
  43. if (_F_Config.help.path != "") {
  44. ui_help = _F_Config.webContent + "/" + _F_Config.help.path;
  45. if (_F_Config.help.path.charAt(_F_Config.help.path.length -1) != '/') {
  46. ui_help += "/";
  47. }
  48. }
  49. if ( ui_help != "") {
  50. var sLocale = "<out:value-of select="$pui-locale"/>";
  51. <!-- Use the first two letters of the locale string to construct the path to the localized help folder. -->
  52. <!-- Make sure they are converted to lowercase. -->
  53. var sLang = sLocale.substring(0,2).toLowerCase();
  54. if ( _F_Config.help.langs.indexOf(" " + sLang + " ") &lt; 0) {
  55. sLang = "en";
  56. }
  57. var helpId = "IDH_";
  58. if (window.portalAgent === undefined || portalAgent.indexOf("cognos") == 0) {
  59. helpId += "COGNOS_"
  60. }
  61. helpId += "<out:value-of select="$context"/>";
  62. var colonIndex = _THIS_.mode.indexOf(":");
  63. var mode = (colonIndex == -1) ? _THIS_.mode.toUpperCase() : _THIS_.mode.substr(colonIndex+1).toUpperCase();
  64. if (mode != "" ) {
  65. helpId += "_" + mode;
  66. }
  67. else {
  68. helpId += "_HELP";
  69. }
  70. var sHelpTopic = help_bookFile + "?helpid=" + helpId;
  71. var sURL = ui_help + sLang + "/" + sHelpTopic;
  72. if (redirect != null &amp;&amp; redirect) {
  73. document.location.href = sURL;
  74. } else {
  75. windowHelp = window.open(sURL, "cps_help", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500");
  76. if (windowHelp != null) {
  77. windowHelp.focus();
  78. }
  79. }
  80. }
  81. else {
  82. window.alert(PFM.JS.IDS_JS_NO_HELP_URL);
  83. }
  84. }
  85. </script>
  86. </xsl:template>
  87. <xsl:template match="pui:delegatehelpscript">
  88. <out:variable name="org-target" select="/root/controllerParams/param[@name='frag-originaltarget']"/>
  89. <script type="text/javascript">
  90. function _THIS_doHelp()
  91. {
  92. var sURL = _F_Config.expandMacros(_THIS_.baseURI());
  93. sURL += ((sURL.indexOf('?') >= 0) ? "&amp;" : "?") + "frag-mode=help";
  94. var windowHelp = window.open(sURL, "cps_help",
  95. "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500");
  96. if (windowHelp != null) {
  97. windowHelp.focus();
  98. }
  99. }
  100. </script>
  101. </xsl:template>
  102. <xsl:template match="pui:aboutscript">
  103. <out:variable name="pui-skin" >
  104. <xsl:choose>
  105. <xsl:when test="string(/root/preferences/param[@name='skin']) = ''">corporate</xsl:when>
  106. <xsl:otherwise><xsl:value-of select="/root/preferences/param[@name='skin']"/></xsl:otherwise>
  107. </xsl:choose>
  108. </out:variable>
  109. <script type="text/javascript">
  110. function _THIS_doAbout()
  111. {
  112. var messageFileURL = "_THIS?frag-urlType=resourceproxy&amp;frag-resource=/ps/portal/js/about/ps/nls/psuiaboutmsg_THELOCALE.js/THIS_";
  113. // using new Object().href will trigger a required url rewriting in some 3rd party portals
  114. var localizedMessageFileURL = new Object().href = messageFileURL.replace("THELOCALE", _F_Config.productLocale);
  115. var defaultMessageFileURL = new Object().href = messageFileURL.replace("THELOCALE", "en");
  116. var helpAB = new about_dialog(_F_Config.webContent + "/ps/portal/images/about/cc_about_" + _F_Config.productLocale +".jpg", _F_Config.webContent + "/ps/portal/images/about/cc_about_en.jpg", localizedMessageFileURL, defaultMessageFileURL);
  117. helpAB.show();
  118. }
  119. </script>
  120. </xsl:template>
  121. <xsl:template match="*">
  122. <xsl:copy>
  123. <xsl:copy-of select="@*"/>
  124. <xsl:apply-templates/>
  125. </xsl:copy>
  126. </xsl:template>
  127. </xsl:stylesheet>
  128. <!-- $Header: //cpscrn/main/src/java/etc/webapps/cps/WEB-INF/fragments/producers/common/logic/portal-ui.xslt#1 $ -->
  129. <!-- $DateTime: 2008/10/22 11:12:04 $ -->
  130. <!-- $Change: 25109 $ -->