buildFavorites.xslt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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, 2012
  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:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  15. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  16. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  17. exclude-result-prefixes="xts xtsext xts pf xsl">
  18. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  19. <pf:variables/>
  20. <xsl:variable name="dashboardFavorites" select="/root/favoritesFolder/*[local-name()='queryResponse']//*[local-name()='dashboard']"/>
  21. <xsl:variable name="iconName" select="/root/system/param[@name='ui_objects']/object[@class='dashboard']/@icon"/>
  22. <xsl:variable name="hasDashboards" select="count($dashboardFavorites)>0"/>
  23. <xsl:variable name="canUseAdvancedFeatures" select="/root/session/param[@name='capabilities']/*[local-name()='canUseAdvancedDashboardFeatures']"/>
  24. <xsl:variable name="isChromeless" select="string(/root/generalConfigSettings/configuration/property[@name='portal.launchBusinessInsightChromeless']) = 'true'"/>
  25. <xsl:variable name="errURL" select="/root/system/param[@name='COGNOSHome']"/>
  26. <xsl:template match="/root">
  27. <favorites>
  28. <dashboard>
  29. <script>
  30. function launchICDFavorite(id) {
  31. var winProp = "menubar=no,toolbar=no,status=no,location=no,resizable=yes,scrollbars=yes";
  32. var uierrURL = "<xsl:value-of select="$errURL"/>";
  33. if(id != '')
  34. {
  35. <xsl:choose>
  36. <xsl:when test="$isChromeless">cognosLaunchInWindow('_blank', winProp, 'ui.gateway', g_PS_gateway, 'ui.tool', 'DashboardConsole', 'ui.action', 'edit', 'ui.id', id);</xsl:when>
  37. <xsl:otherwise>
  38. directLaunch('ui.gateway', sGateway, 'ui.tool', 'DashboardConsole', 'ui.action', 'edit', 'ui.id', id, 'ui.errURL', uierrURL);
  39. </xsl:otherwise>
  40. </xsl:choose>
  41. }
  42. else
  43. {
  44. <xsl:choose>
  45. <xsl:when test="$isChromeless">cognosLaunchInWindow('_blank', winProp, 'ui.gateway', sGateway, 'ui.tool', 'DashboardConsole', 'ui.action', 'new');</xsl:when>
  46. <xsl:otherwise>
  47. directLaunch('ui.gateway', sGateway, 'ui.tool', 'DashboardConsole', 'ui.action', 'new','ui.errURL', uierrURL);
  48. </xsl:otherwise>
  49. </xsl:choose>
  50. }
  51. }
  52. </script>
  53. <title>
  54. <xsl:choose>
  55. <xsl:when test="$hasDashboards">
  56. <xsl:choose>
  57. <xsl:when test="$canUseAdvancedFeatures"><xts:string id="IDS_WELCOME_DASHBOARD_DESC"/></xsl:when>
  58. <xsl:otherwise><xts:string id="IDS_WELCOME_DASHBOARD_VIEW_FAV_DESC"/></xsl:otherwise>
  59. </xsl:choose>
  60. </xsl:when>
  61. <xsl:otherwise>
  62. <xsl:choose>
  63. <xsl:when test="$canUseAdvancedFeatures"><xts:string id="IDS_WELCOME_DASHBOARD_NEW_DESC"/></xsl:when>
  64. <xsl:otherwise><xts:string id="IDS_WELCOME_IBM_COGNOS_DASHBOARD_VIEW_NOFAV_DESC"/></xsl:otherwise>
  65. </xsl:choose>
  66. </xsl:otherwise>
  67. </xsl:choose>
  68. </title>
  69. <action>javascript:launchICDFavorite('')</action>
  70. <xsl:if test="$hasDashboards">
  71. <flyout>
  72. <caption><xts:string id="IDS_WELCOME_FAVORITES"/></caption>
  73. <entries>
  74. <xsl:apply-templates select="$dashboardFavorites" mode="dashboard"/>
  75. <xsl:if test="$canUseAdvancedFeatures">
  76. <item createWksp="true">
  77. <image><xsl:value-of select="$image_root"/>action_new_<xsl:value-of select="$iconName"/>.gif</image>
  78. <altText><xts:string id="IDS_WELCOME_DASHBOARD_NEW_DESC"/></altText>
  79. <name><xts:string id="IDS_WELCOME_CREATE_NEW_DASHBOARD"/></name>
  80. <action>javascript:launchICDFavorite('')</action>
  81. </item>
  82. </xsl:if>
  83. </entries>
  84. </flyout>
  85. </xsl:if>
  86. </dashboard>
  87. </favorites>
  88. </xsl:template>
  89. <xsl:template match="*[local-name()='dashboard']" mode="dashboard">
  90. <item>
  91. <image><xsl:value-of select="$image_root"/>icon_<xsl:value-of select="$iconName"/>.gif</image>
  92. <altText><xts:string id="IDS_ACT_OPEN_DASHBOARD_ALT"><xts:param name="name"><xsl:value-of select="./*[local-name()='defaultName']"/></xts:param></xts:string></altText>
  93. <ariaText><xts:string id="IDS_ACT_OPEN_DASHBOARD_ARA"><xts:param name="name"><xsl:value-of select="./*[local-name()='defaultName']"/></xts:param></xts:string></ariaText>
  94. <name><xsl:value-of select="./*[local-name()='defaultName']"/></name>
  95. <action>javascript:launchICDFavorite('<xsl:value-of select="./*[local-name()='storeID']"/>')</action>
  96. </item>
  97. </xsl:template>
  98. <xsl:template match="*"/>
  99. </xsl:stylesheet>