addMetrics.xts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2014
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/AGS.xml,messages/portal.xml, messages/portalRL.xml" resolverBase="prompting" includeConfig="true" requiredCapability="canUseEventStudio,canUseMetricsManagerAdministration">
  9. <!--
  10. ===============================================================================================
  11. get the information for the agent - we only need the defaultName thought for the time being
  12. ===============================================================================================
  13. -->
  14. <xts:block id="getSelectedPath" type="exec" mode="interpret" processor="XSLT" condition=".[/root/env/param[@name = 'selected_path']!='' and /root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup']" mandatory="false">
  15. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  16. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/">
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  18. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  19. <xsl:template match="/">
  20. <xts:sequence>
  21. <xts:append>
  22. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  23. <send:request provider="cm" requester="AGS:addMatrics">
  24. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  25. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  26. <search>
  27. <!-- Get the report - we know only it's search path now -->
  28. <xsl:value-of select="/root/env/param[@name = 'selected_path']"/>
  29. </search>
  30. <properties>
  31. <property name="defaultName"/>
  32. <property name="searchPath"/>
  33. </properties>
  34. </query>
  35. </xts:transform>
  36. </send:request>
  37. </xts:transform>
  38. </xts:append>
  39. </xts:sequence>
  40. </xsl:template>
  41. </xsl:stylesheet>
  42. </xts:block>
  43. <!--
  44. ===============================================================================================
  45. returnResult - We're done with the email options morphlet, so return the appropriate response
  46. ===============================================================================================
  47. -->
  48. <xts:block id="returnResult" path="/ags/tabResultTemplate.xslt" type="exec" processor="XSLT" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'finished']" mandatory="false">
  49. <xts:logicsheet path="logicsheets/portal.xsl"/>
  50. </xts:block>
  51. <!--
  52. ===============================================================================================
  53. genMarkup -
  54. ===============================================================================================
  55. -->
  56. <xts:block id="genMarkup" type="exec" processor="XSLT" dependency="getSelectedPath" condition=".[/root/*[local-name()='requestParams']/*[local-name()='param' and @name='requestState'] = 'markup'] ">
  57. <!-- logicsheets -->
  58. <xts:logicsheet path="ags/logicsheets/run_options.xslt"/>
  59. <!-- portal specific information -->
  60. <xts:logicsheet path="logicsheets/portal.xsl"/>
  61. <xts:logicsheet path="ags/logicsheets/dialogs.xsl"/>
  62. <xts:logicsheet path="ags/logicsheets/condition-ui-templates.xslt"/>
  63. <!-- Dialog specific logicsheets -->
  64. <xts:logicsheet path="logicsheets/presentation/dialog/ui-templates.xsl"/>
  65. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  66. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  67. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  68. <!-- Generic logicsheets -->
  69. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  70. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  71. <!-- apply the form logic -->
  72. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  73. <!-- Prevent the href from appearing in the status bar. -->
  74. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  75. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:out="http://www.w3.org/1999/XSL/Transform" xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:agsro="http://developer.cognos.com/schemas/xts/agsro" exclude-result-prefixes="out agsdlg xsi cm pf xtsext lyt dp df cf cp xos utml agsro">
  76. <xsl:output method="xml" encoding="utf-8" indent="no"/>
  77. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  78. <pf:variables/>
  79. <xsl:variable name="ags_image_root">../ags/images/summary/</xsl:variable>
  80. <xsl:variable name="mname" select="'dialogAdapter.xts'"/>
  81. <xsl:variable name="spacer">
  82. <img height="10" width="10">
  83. <xsl:attribute name="src"><xsl:value-of select="$webcontent"/>/images/space.gif</xsl:attribute>
  84. </img>
  85. </xsl:variable>
  86. <!-- SEC_INFO hasTask is not javascript encoded, it is always a boolean value true|false-->
  87. <xsl:variable name="hasTask">
  88. <xsl:choose>
  89. <xsl:when test="key('env-param','selected_path') != ''"><xsl:text>true</xsl:text></xsl:when>
  90. <xsl:otherwise><xsl:text>false</xsl:text></xsl:otherwise>
  91. </xsl:choose>
  92. </xsl:variable>
  93. <xsl:variable name="metricTaskName">
  94. <xsl:value-of select="/root/*[local-name()='queryResponse'][starts-with(*,'metric')]//*[local-name()='defaultName']"/>
  95. </xsl:variable>
  96. <xsl:template match="/">
  97. <xts:sequence>
  98. <xts:append select="/root/output">
  99. <xos:part>
  100. <xos:entityHeader>
  101. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  102. </xos:entityHeader>
  103. <xos:entityBody>
  104. <xsl:element name="{key('request-param','resultNode')}" namespace="">
  105. <markup>
  106. <xts:transform name="XMLEncode">
  107. <utml:form name="pform">
  108. <!-- this defines the form command operation to be performed when all the collected properties are submitted... -->
  109. <!-- ================================================================ -->
  110. <!-- H E A D E R -->
  111. <!-- ================================================================ -->
  112. <utml:exclusion-list><xsl:value-of select="' pageitem '"/></utml:exclusion-list>
  113. <agsdlg:header>
  114. <dp:image>
  115. <img alt="" border="0">
  116. <xsl:attribute name="src"><xsl:value-of select="$ags_image_root"/>icon_metrics_maintenance_24.gif</xsl:attribute>
  117. </img>
  118. </dp:image>
  119. <dp:title>
  120. <xts:string id="DIALOG_METRICS_TITLE"/>
  121. </dp:title>
  122. <dp:description>
  123. <xts:string id="DIALOG_METRICS_DESCRIPTION"/>
  124. </dp:description>
  125. </agsdlg:header>
  126. <utml:input type="hidden" name="report_visited" id="report_visited" value="true"/>
  127. <utml:input type="hidden" name="taskName" id="taskName" utml:update="false">
  128. <utml:value>
  129. <xsl:choose>
  130. <xsl:when test="$hasTask='true' and $metricTaskName != '' ">
  131. <xsl:value-of select="$metricTaskName"/>
  132. </xsl:when>
  133. <xsl:when test="key('env-param', 'taskName') and string-length(string(key('env-param', 'taskName'))) > 0">
  134. <xsl:value-of select="key('env-param', 'taskName')"/>
  135. </xsl:when>
  136. </xsl:choose>
  137. </utml:value>
  138. </utml:input>
  139. <!-- ================================================================ -->
  140. <!-- B O D Y -->
  141. <!-- ================================================================ -->
  142. <!-- Define a new layout-->
  143. <lyt:layout style="2">
  144. <lyt:section>
  145. <dp:textarea section3_align="left">
  146. <!-- the CM name label-->
  147. <dp:section1>
  148. <xts:string id="DIALOG_METRICS_LABEL"/>
  149. </dp:section1>
  150. <dp:section2>
  151. <!-- get the name of the metric -->
  152. <xsl:choose>
  153. <xsl:when test="$hasTask='true' and $metricTaskName != '' ">
  154. <xsl:copy-of select="$spacer"/>
  155. <xsl:value-of select="$metricTaskName"/>
  156. </xsl:when>
  157. <xsl:otherwise>
  158. <xts:string id="DIALOG_MESSAGE_NONE"/>
  159. </xsl:otherwise>
  160. </xsl:choose>
  161. </dp:section2>
  162. <!-- metricsMaintenanceTask -->
  163. <dp:section3>
  164. <a href="#" onclick="doSelectObject('metricTask.es', '{xtsext:javascriptencode(/root/env/param[@name = 'selected_path'])}')">
  165. <xts:string id="SELECT_METRICS"/>
  166. </a>
  167. </dp:section3>
  168. </dp:textarea>
  169. </lyt:section>
  170. <lyt:section>
  171. <xsl:value-of select="key('request-param','suppressionDetails')" disable-output-escaping="yes"/>
  172. </lyt:section>
  173. </lyt:layout>
  174. <dp:emptyFooter/>
  175. <script type="text/javascript">
  176. function init() {
  177. <xsl:if test="not(/root/env/param[@name='report_visited'])">
  178. <xsl:if test="not(/root/env/param[@name='selected_path'])">
  179. doSelectObject('metricTask.es')
  180. </xsl:if>
  181. </xsl:if>
  182. }
  183. /*
  184. * validate the report page and popup an appropriate alert message
  185. */
  186. function validate() {
  187. var hasTask = <xsl:value-of select="string($hasTask)"/>;
  188. var isValid = true;
  189. if (hasTask==false) {
  190. isValid = false;
  191. alert(&quot;<xts:string id="DIALOG_METRICS_NO_TASK" encode="javascript"/>&quot;);
  192. }
  193. return isValid;
  194. }
  195. function leavingDialog() {
  196. var oc = &quot;<xsl:value-of select="/root/*[local-name()='queryResponse'][starts-with(*,'metric')]//*[local-name()='objectClass']"/>&quot;;
  197. if(window.argumentsLeavingDialog){
  198. argumentsLeavingDialog();
  199. }
  200. if (oc != "") {
  201. var i = document.getElementById("objectClass");
  202. if (i == undefined || i == null) {
  203. i = document.createElement("INPUT");
  204. }
  205. i.setAttribute("name", "objectClass");
  206. i.setAttribute("id", "objectClass");
  207. i.setAttribute("value", oc);
  208. i.setAttribute("type", "hidden");
  209. document.pform.appendChild(i);
  210. }
  211. }
  212. </script>
  213. </utml:form>
  214. </xts:transform>
  215. </markup>
  216. </xsl:element>
  217. </xos:entityBody>
  218. </xos:part>
  219. </xts:append>
  220. </xts:sequence>
  221. </xsl:template>
  222. </xsl:stylesheet>
  223. </xts:block>
  224. <!--
  225. ===============================================================================================
  226. debug - special debug block for nested requests
  227. ===============================================================================================
  228. -->
  229. <xts:block id="debug" type="exec" processor="XSLT" mimeType="text/html" dependency="genMarkup" condition=".[/root/session/param[@name='debug']='1']" mandatory="false">
  230. <!-- Get the debug logic sheet -->
  231. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  232. <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">
  233. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  234. <xsl:template match="/">
  235. <dbg:dumpxml select="/root"/>
  236. </xsl:template>
  237. </xsl:stylesheet>
  238. </xts:block>
  239. </xts:morphlet>