metrics.xslt 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  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. <!--
  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:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  15. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  16. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  17. xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd"
  18. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  19. xmlns:resource-prop="http://developer.cognos.com/admin/properties"
  20. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  21. xmlns:cogadminext="xalan://com.cognos.admin.xts.ext.XTSExt"
  22. xmlns:ns1="http://docs.oasis-open.org/wsdm/muws1-2.xsd"
  23. xmlns:admui="http://developer.cognos.com/schemas/xts/admui"
  24. xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2"
  25. xmlns:nemo="http://developer.cognos.com/nemo"
  26. exclude-result-prefixes="wsrf-rp nemo resource-prop admui xtsext xsl ns1 ui uic SOAP-ENV muws2 xts">
  27. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  28. <xsl:key name="properties" match="/root/wsrf-rp:GetMultipleResourcePropertiesResponse/*" use="local-name()"/>
  29. <xsl:key name="groupIDs" match="/root/metadata/wsrf-rp:GetMultipleResourcePropertiesResponse/nemo:MetadataDescriptor/nemo:PropertiesGroups/nemo:PropertiesGroup" use="nemo:URI"/>
  30. <xsl:variable name="metadataDescriptor" select="/root/metadata/wsrf-rp:GetMultipleResourcePropertiesResponse/nemo:MetadataDescriptor"/>
  31. <xsl:key name="property-metadata" match="/root/metadata/wsrf-rp:GetMultipleResourcePropertiesResponse/nemo:MetadataDescriptor/nemo:Property" use="nemo:Name"/>
  32. <xsl:key name="property-metadata-by-group" match="/root/metadata/wsrf-rp:GetMultipleResourcePropertiesResponse/nemo:MetadataDescriptor/nemo:Property" use="nemo:MetricGroup"/>
  33. <xsl:variable name="resourceID" select="xtsext:javascriptencode(xtsext:urlencode(string(/root/resourceID)))"/>
  34. <!-- display variables -->
  35. <admui:variables/>
  36. <ui:commonTemplates/>
  37. <xsl:template match="/root">
  38. <uic:fragment>
  39. <xsl:variable name="properties" select="/root/wsrf-rp:GetMultipleResourcePropertiesResponse/*"/>
  40. <xsl:variable name="goodCount" select="count($properties[@Health='Good'])"/>
  41. <xsl:variable name="averageCount" select="count($properties[@Health='Average'])"/>
  42. <xsl:variable name="poorCount" select="count($properties[@Health='Poor'])"/>
  43. <xsl:variable name="metricsFilter">
  44. <xsl:choose>
  45. <xsl:when test="key('env-param', 'metricsFilter') != ''">
  46. <xsl:value-of select="key('env-param', 'metricsFilter')"/>
  47. </xsl:when>
  48. <xsl:otherwise>
  49. <xsl:value-of select="':None:Poor:Average:Good:NotApplicable::'"/>
  50. </xsl:otherwise>
  51. </xsl:choose>
  52. </xsl:variable>
  53. <div style="padding-top:5px; padding-bottom:5px">
  54. <xsl:call-template name="healthSummary">
  55. <xsl:with-param name="poorCount" select="$poorCount"/>
  56. <xsl:with-param name="averageCount" select="$averageCount"/>
  57. <xsl:with-param name="goodCount" select="$goodCount"/>
  58. <xsl:with-param name="filter" select="true()"/>
  59. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  60. </xsl:call-template>
  61. </div>
  62. <script>
  63. _THIS_onCadminWindowstateChange = function (evt) {
  64. if (evt.source != _THIS_)
  65. switch (evt.payload){
  66. case "minimized":
  67. _THIS_.cogadminWindowState = "extended";
  68. setContentTableHeight ("_THIS_","extended",2);
  69. break;
  70. case "normal":
  71. _THIS_.cogadminWindowState = null;
  72. setContentTableHeight ("_THIS_","normal",2);
  73. break;
  74. default:
  75. }
  76. return true;
  77. }
  78. regFragEvent(_THIS_,"cogadmin.fragment.windowstate.change",_THIS_onCadminWindowstateChange);
  79. _THIS_onReloadEvent = function(evt) {
  80. if (evt.source != _THIS_) {
  81. removeReloadEventListener(_THIS_, "_THIS_onReloadEvent");
  82. raiseReloadEvent(_THIS_, null, true);
  83. _THIS_retrieve();
  84. }
  85. }
  86. addReloadEventListener(_THIS_, "_THIS_onReloadEvent");
  87. _THIS_onWindowstateChange = function (evt) {
  88. var winState = evt.payload.newWindowState;
  89. if (winState == "normal" &amp;&amp; _THIS_.cogadminWindowState)
  90. winState = _THIS_.cogadminWindowState;
  91. setContentTableHeight ("_THIS_",winState,2);
  92. _THIS_.raiseEvent("cogadmin.fragment.windowstate.change",evt.payload.newWindowState);
  93. return true;
  94. }
  95. regFragEvent(_THIS_,"fragment.windowstate.change",_THIS_onWindowstateChange);
  96. _THIS_adjustFrgSize = function (evt) {
  97. var winState = _THIS_.cogadminWindowState || _THIS_.windowState;
  98. setContentTableHeight ("_THIS_",winState,2);
  99. return true;
  100. }
  101. //the reason for the following line is the fragment.addEventListener won't work for fragment.resize event
  102. _THIS_.onresize = _THIS_adjustFrgSize;
  103. regFragEvent(_THIS_,"fragment.load",_THIS_adjustFrgSize);
  104. _THIS_.getGroupDescription = function(groupNum) {
  105. return window['g__THIS_'+groupNum+'_groupcaption'].tooltipdef.items[0].value;
  106. };
  107. </script>
  108. <!-- the exaggerated height for this table is a hack to avoid the flashing in firefox when navigating in Relationship -->
  109. <uic:table width="100%" id="_THIS_contentTable" height="2000px">
  110. <uic:features>
  111. <uic:name>table_fragment</uic:name>
  112. <uic:aria-label>
  113. <xts:transform name="XMLEncode">
  114. <xts:string id="IDS_ADM_MET_HEADER">
  115. <xts:param name="0">
  116. <xsl:value-of select="/root/metadata/*[local-name()='GetMultipleResourcePropertiesResponse']/*[local-name()='Caption']"/>
  117. </xts:param>
  118. </xts:string>
  119. </xts:transform>
  120. </uic:aria-label>
  121. <uic:scrollable y="40"/>
  122. <uic:gridView/>
  123. <uic:type>group</uic:type>
  124. <uic:hideTenant>true</uic:hideTenant>
  125. <uic:collapsed><xsl:value-of select="not(contains(key('env-param', 'expandedGroups'),'toggleHeader'))"/></uic:collapsed>
  126. <ui:tableFeatures/>
  127. </uic:features>
  128. <uic:header>
  129. <uic:row>
  130. <!-- TODO: replace style with CSS class -->
  131. <uic:column width="75%" nowrap="nowrap">
  132. <uic:text>
  133. <xts:string id="IDS_ADM_SET_TABLE_HEADER_NAME"/>
  134. </uic:text>
  135. </uic:column>
  136. <uic:column width="5%" align="center">
  137. <uic:icon>
  138. <uic:src>
  139. <admui:imageURL image="icon_streetlight.gif" type="cogadmin"/>
  140. </uic:src>
  141. <uic:tooltip>
  142. <xts:string id="IDS_ADM_TOP_HEALTH_TOOLTIP"/>
  143. </uic:tooltip>
  144. </uic:icon>
  145. </uic:column>
  146. <uic:column width="20%">
  147. <uic:text>
  148. <xts:string id="IDS_ADM_SET_TABLE_HEADER_VALUE"/>
  149. </uic:text>
  150. </uic:column>
  151. </uic:row>
  152. </uic:header>
  153. <uic:body>
  154. <xsl:for-each select="/root/wsrf-rp:GetMultipleResourcePropertiesResponse/*">
  155. <xsl:sort select="key('property-metadata', string(local-name()))/nemo:Caption" order="ascending" lang="{/root/contentLocale}"/>
  156. <xsl:variable name="propertyName" select="local-name()"/>
  157. <xsl:variable name="metadataPropertyInfo" select="key('property-metadata', string($propertyName))"/>
  158. <xsl:variable name="groupPosition" select="position()"/>
  159. <!-- if the property has a metric group, but the group URI doesn't match any of the groups in the metadata -->
  160. <xsl:if test="$metadataPropertyInfo/nemo:MetricGroup and not($metadataPropertyInfo[key('groupIDs',nemo:MetricGroup)])">
  161. <uic:row>
  162. <uic:column>
  163. <uic:text>
  164. <xts:string id="IDS_ADM_MET_UNKNOWN_GROUP">
  165. <xts:param name="group">
  166. <xsl:value-of select="$metadataPropertyInfo/nemo:MetricGroup"/>
  167. </xts:param>
  168. </xts:string>
  169. </uic:text>
  170. </uic:column>
  171. </uic:row>
  172. <xsl:variable name="caption">
  173. <xsl:choose>
  174. <xsl:when test="$metadataPropertyInfo/nemo:Caption != ''">
  175. <xsl:value-of select="$metadataPropertyInfo/nemo:Caption"/>
  176. </xsl:when>
  177. <xsl:otherwise>
  178. <xsl:value-of select="$propertyName"/>
  179. </xsl:otherwise>
  180. </xsl:choose>
  181. </xsl:variable>
  182. <xsl:call-template name="metricRow">
  183. <xsl:with-param name="caption" select="$caption"/>
  184. <xsl:with-param name="desc" select="$metadataPropertyInfo/nemo:Description"/>
  185. <xsl:with-param name="name" select="$propertyName"/>
  186. <xsl:with-param name="value" select="."/>
  187. <xsl:with-param name="groupNum" select="$groupPosition"/>
  188. <xsl:with-param name="rowID" select="concat($groupPosition, '_unkownGroup')"/>
  189. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  190. </xsl:call-template>
  191. </xsl:if>
  192. <xsl:if test="not($metadataPropertyInfo/nemo:MetricGroup) and starts-with(string($metadataPropertyInfo/nemo:Capability),'http://docs.oasis-open.org/wsdm/2004/12/muws/capabilities/Metrics')">
  193. <!-- if the property does not belong to a metric group -->
  194. <xsl:variable name="caption">
  195. <xsl:choose>
  196. <xsl:when test="$metadataPropertyInfo/nemo:Caption != ''">
  197. <xsl:value-of select="$metadataPropertyInfo/nemo:Caption"/>
  198. </xsl:when>
  199. <xsl:otherwise>
  200. <xsl:value-of select="$propertyName"/>
  201. </xsl:otherwise>
  202. </xsl:choose>
  203. </xsl:variable>
  204. <xsl:call-template name="metricRow">
  205. <xsl:with-param name="caption" select="$caption"/>
  206. <xsl:with-param name="desc" select="$metadataPropertyInfo/nemo:Description"/>
  207. <xsl:with-param name="name" select="$propertyName"/>
  208. <xsl:with-param name="value" select="."/>
  209. <xsl:with-param name="groupNum" select="$groupPosition"/>
  210. <xsl:with-param name="rowID" select="concat($groupPosition, '_unkownGroup')"/>
  211. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  212. </xsl:call-template>
  213. </xsl:if>
  214. </xsl:for-each>
  215. <!--xsl:variable name="expandedGroups">/3/7/9</xsl:variable-->
  216. <!-- Process each of the possible groups -->
  217. <xsl:for-each select="$metadataDescriptor/nemo:PropertiesGroups/nemo:PropertiesGroup">
  218. <xsl:sort select="nemo:Caption" order="ascending" lang="{/root/contentLocale}"/>
  219. <xsl:variable name="groupID" select="nemo:URI"/>
  220. <xsl:variable name="groupCaption" select="nemo:Caption"/>
  221. <xsl:variable name="groupDesc" select="nemo:Description"/>
  222. <xsl:variable name="groupPosition" select="position()"/>
  223. <!-- handle all the properties that belong to a group -->
  224. <xsl:variable name="groupMetrics" select="key('property-metadata-by-group', string($groupID))[key('properties', nemo:Name)]"/>
  225. <xsl:for-each select="$groupMetrics">
  226. <xsl:sort select="nemo:Caption" order="ascending" lang="{/root/contentLocale}"/>
  227. <xsl:variable name="propertyPosition" select="position()"/>
  228. <xsl:variable name="metricGrpActions" select="/root/wsrf-rp:GetMultipleResourcePropertiesResponse/*[local-name() = 'SupportedMetricGroupActions']/*[local-name() = 'Action']"/>
  229. <xsl:if test="count(key('properties', $groupMetrics/nemo:Name)[contains($metricsFilter,concat(':',@Health,':'))]) > 0">
  230. <xsl:if test="position() = 1">
  231. <xsl:text disable-output-escaping="yes">&lt;uic:group groupNum="</xsl:text><xsl:value-of select="$groupPosition"/>"<xsl:text> key="</xsl:text>
  232. <xsl:value-of select="$groupID"/>
  233. <xsl:text disable-output-escaping="yes">" collapsible="true" collapsed="</xsl:text>
  234. <xsl:value-of select="not(contains(key('env-param', 'expandedGroups'),$groupID))"/>
  235. <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
  236. <uic:name>
  237. <script>
  238. var g__THIS_<xsl:value-of select="$groupPosition"/>_groupcaption = new ui_tooltip(
  239. {
  240. id: '<xsl:value-of select="xtsext:javascriptencode(string($groupPosition))"/>',
  241. items: [
  242. new captionTooltipRenderer('<xts:string id="IDS_ADM_TOO_DESCRIPTION" encode="javascript"/>','<xsl:value-of select="xtsext:javascriptencode(string($groupDesc))"/>')
  243. ]
  244. });
  245. </script>
  246. <uic:tooltipText onmouseover="g__THIS_{$groupPosition}_groupcaption.show(event);" onmouseout="g__THIS_{$groupPosition}_groupcaption.hide(event);" onmousemove="g__THIS_{$groupPosition}_groupcaption.mousemove(event);"><xsl:value-of select="$groupCaption"/></uic:tooltipText>
  247. </uic:name>
  248. <xsl:variable name="canBeReset" select="count($groupMetrics[nemo:CanBeReset = 'true']) &gt; 0"/>
  249. <xsl:if test="$canBeReset">
  250. <!-- loop through all the actions -->
  251. <xsl:for-each select="$metricGrpActions">
  252. <xsl:variable name="actionName" select="."/>
  253. <xsl:for-each select="$metadataDescriptor/nemo:Action[nemo:Name = $actionName]">
  254. <!-- FOR NOW, THERE SHOULD ONLY BE 1 -->
  255. <xsl:variable name="encodedAction" select="xtsext:javascriptencode(string(nemo:Name))"/>
  256. <xsl:variable name="caption">
  257. <xsl:choose>
  258. <xsl:when test="nemo:Caption != ''">
  259. <xsl:value-of select="nemo:Caption"/>
  260. </xsl:when>
  261. <xsl:otherwise><xsl:value-of select="resource-prop:Name"/></xsl:otherwise>
  262. </xsl:choose>
  263. </xsl:variable>
  264. <xsl:variable name="encodedCaption" select="xtsext:javascriptencode($caption)"/>
  265. <uic:icon id="{concat($groupPosition,'_groupicon')}" valign="middle" aria-labelledBy="{concat('_THIS_',$groupPosition,'_groupcaption',' ',$groupPosition,'_groupicon')}">
  266. <uic:src>
  267. <admui:imageURL>
  268. <admui:image><xsl:value-of select="nemo:Icon"/></admui:image>
  269. </admui:imageURL>
  270. </uic:src>
  271. <uic:tooltip><xsl:value-of select="$caption"/></uic:tooltip>
  272. <uic:onclick>var cr = new cogadmin_relationships(_THIS_, '_THIS_', null,'<xsl:value-of select="$resourceID"/>'); cr.doAction({action:'<xsl:value-of select="$encodedAction"/>',actionLabel:'<xsl:value-of select="$encodedCaption"/> [<xsl:value-of select="xtsext:javascriptencode($groupCaption)"/>]',capability:'<xsl:value-of select="xtsext:urlencode(nemo:Capability)"/>',argument:'<xsl:value-of select="xtsext:urlencode($groupID)"/>'})</uic:onclick>
  273. </uic:icon>
  274. </xsl:for-each>
  275. </xsl:for-each>
  276. </xsl:if>
  277. <uic:summary>
  278. <xsl:call-template name="healthSummary">
  279. <xsl:with-param name="poorCount" select="count(key('properties', $groupMetrics/nemo:Name)[@Health = 'Poor'])"/>
  280. <xsl:with-param name="averageCount" select="count(key('properties', $groupMetrics/nemo:Name)[@Health = 'Average'])"/>
  281. <xsl:with-param name="goodCount" select="count(key('properties', $groupMetrics/nemo:Name)[@Health = 'Good'])"/>
  282. <xsl:with-param name="groupPosition" select="$groupPosition"/>
  283. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  284. </xsl:call-template>
  285. </uic:summary>
  286. </xsl:if>
  287. <xsl:variable name="caption">
  288. <xsl:choose>
  289. <xsl:when test="nemo:Caption != ''">
  290. <xsl:value-of select="nemo:Caption"/>
  291. </xsl:when>
  292. <xsl:otherwise>
  293. <xsl:value-of select="nemo:Name"/>
  294. </xsl:otherwise>
  295. </xsl:choose>
  296. </xsl:variable>
  297. <xsl:call-template name="metricRow">
  298. <xsl:with-param name="caption" select="$caption"/>
  299. <xsl:with-param name="desc" select="nemo:Description"/>
  300. <xsl:with-param name="name" select="nemo:Name"/>
  301. <xsl:with-param name="value" select="key('properties', nemo:Name)"/>
  302. <xsl:with-param name="groupNum" select="$groupPosition"/>
  303. <xsl:with-param name="rowID" select="concat($groupPosition, '_', $propertyPosition)"/>
  304. <xsl:with-param name="grpCaption" select="$groupCaption"/>
  305. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  306. <xsl:with-param name="canExecuteActions" select="count($metricGrpActions) &gt; 0"/>
  307. </xsl:call-template>
  308. <xsl:if test="position() = last()">
  309. <xsl:text disable-output-escaping="yes">&lt;/uic:group&gt;</xsl:text>
  310. </xsl:if>
  311. </xsl:if>
  312. </xsl:for-each>
  313. </xsl:for-each>
  314. </uic:body>
  315. <uic:footer displayLastUpdate="true" />
  316. </uic:table>
  317. <!-- this is the div that will hold the threshold fragment -->
  318. <div id="_THIS_thresholdcontent" style="overflow:auto; background-color: #ffffff; border: #e3e9f3 3px outset; display: none; position: absolute;"/>
  319. <script>
  320. var _THIS_filter = '<xsl:value-of select="$metricsFilter"/>';
  321. _THIS_onRefresh = function(evt) {
  322. evt.preventDefault();
  323. _THIS_retrieve();
  324. }
  325. regFragEvent(_THIS_,"fragment.refresh",_THIS_onRefresh);
  326. <!-- create the fragment to handle the threshold -->
  327. var _THIS_threshold = createFragment('_THIS_threshold', null, '<xsl:value-of select="xtsext:javascriptencode(string('/cogadmin/controls/threshold.xts'))"/>');
  328. function _THIS_openDialog(grpCaption, objCaption, name, type) {
  329. var params = 'thresholdGroupName='+ grpCaption +'&amp;thresholdPropertyCaption='+ objCaption +'&amp;thresholdPropertyName='+ name +'&amp;thresholdResourceID=<xsl:value-of select="$resourceID"/>&amp;propertyType='+type+'&amp;style=dialog';
  330. _THIS_threshold.retrieve(params);
  331. }
  332. function _THIS_setFilter(health, enabled) {
  333. if (enabled) {
  334. _THIS_filter+=health;
  335. } else {
  336. _THIS_filter = _THIS_filter.replace(health,'');
  337. }
  338. _THIS_retrieve('metricsFilter='+_THIS_filter);
  339. }
  340. function _THIS_retrieve(params) {
  341. var expandedGroups = getExpandedTableGroups($('_THIS_contentTable'));
  342. if (expandedGroups.length > 0) {
  343. params=generateQueryString(params,'expandedGroups',expandedGroups);
  344. }
  345. scrollTop=$('_THIS_contentTable').scrollTop;
  346. params=generateQueryString(params,'scrollPos',scrollTop);
  347. _THIS_.retrieve(params);
  348. }
  349. <xsl:if test="key('env-param', 'scrollPos') != ''">
  350. function _THIS_afterRetrieve(evt) {
  351. if (evt.eventPhase == evt.AT_TARGET) {
  352. $('_THIS_contentTable').scrollTop = <xsl:value-of select="key('env-param', 'scrollPos')"/>;
  353. }
  354. }
  355. regFragEvent(_THIS_,"fragment.retrieve.after",_THIS_afterRetrieve);
  356. </xsl:if>
  357. </script>
  358. </uic:fragment>
  359. </xsl:template>
  360. <xsl:template name="metricRow">
  361. <xsl:param name="caption" select="''"/>
  362. <xsl:param name="desc" select="''"/>
  363. <xsl:param name="name" select="''"/>
  364. <xsl:param name="value" select="''"/>
  365. <xsl:param name="groupNum" select="''"/>
  366. <xsl:param name="rowID" select="''"/>
  367. <xsl:param name="grpCaption" select="''"/>
  368. <xsl:param name="metricsFilter" select="''"/>
  369. <xsl:param name="canExecuteActions" select="''"/>
  370. <xsl:variable name="lastResetAt" select="key('properties', $name)/@ResetAt"/>
  371. <xsl:variable name="lastUpdate" select="key('properties', $name)/@LastUpdated"/>
  372. <xsl:variable name="health" select="key('properties', $name)/@Health"/>
  373. <xsl:variable name="currentProperty" select="key('property-metadata', string($name))"/>
  374. <xsl:variable name="canSetThreshold" select="$canExecuteActions and ($currentProperty/nemo:CanSetThreshold = 'true')"/>
  375. <xsl:if test="contains($metricsFilter,concat(':',$health,':'))">
  376. <uic:row name="{$health}">
  377. <xsl:variable name="displayValue">
  378. <xsl:call-template name="updateMetricValue">
  379. <xsl:with-param name="value" select="$value"/>
  380. <xsl:with-param name="rowID" select="$rowID"/>
  381. <xsl:with-param name="name" select="$name"/>
  382. </xsl:call-template>
  383. </xsl:variable>
  384. <!-- build the tooltip -->
  385. <script>
  386. var g__THIS_<xsl:value-of select="$rowID"/>_caption = new ui_tooltip(
  387. {
  388. id: '<xsl:value-of select="xtsext:javascriptencode(string($rowID))"/>',
  389. items: [
  390. new captionTooltipRenderer('<xts:string id="IDS_ADM_TOO_DESCRIPTION" encode="javascript"/>','<xsl:value-of select="xtsext:javascriptencode(string($desc))"/>')
  391. ]
  392. });
  393. <xsl:variable name="values">
  394. [
  395. <xsl:for-each select="$value/value | $displayValue[not($value/value)]">
  396. '<xsl:value-of select="xtsext:javascriptencode(string(.))"/>'
  397. <xsl:if test="position() != last()">,</xsl:if>
  398. </xsl:for-each>
  399. ]
  400. </xsl:variable>
  401. var g__THIS_<xsl:value-of select="$rowID"/>_value = new ui_tooltip(
  402. {
  403. id: '<xsl:value-of select="xtsext:javascriptencode(string($rowID))"/>',
  404. expandText: '<xts:string id="IDS_ADM_EXPAND_TOOLTIP" encode="javascript"/>',
  405. webcontent: '<admui:imageURL type="skin"/>',
  406. expandStyle: 'append',
  407. expandIdx: 1,
  408. items: [
  409. new attrValueTooltipRenderer('<xts:string id="IDS_ADM_TOO_NAME" encode="javascript"/>','<xsl:value-of select="xtsext:javascriptencode(string($caption))"/>'),
  410. new attrValueTooltipRenderer('<xts:string id="IDS_ADM_TOO_VALUE" encode="javascript"/>',<xsl:value-of select="$values"/>)
  411. <xsl:if test="$lastResetAt != ''">
  412. ,new attrValueTooltipRenderer( '<xts:string id="IDS_ADM_TOO_LAST_RESET_TIME" encode="javascript"/>','<xsl:value-of select="xtsext:javascriptencode(string(xtsext:formatDateFromUTC(string($lastResetAt), number('2'), number('3'), string(/root/timezone), string(/root/contentLocale))))"/>')
  413. </xsl:if>
  414. <xsl:if test="$lastUpdate != ''">
  415. ,new attrValueTooltipRenderer('<xts:string id="IDS_ADM_TOO_LAST_UPDATE_TIME" encode="javascript"/>', '<xsl:value-of select="xtsext:javascriptencode(string(xtsext:formatDateFromUTC(string($lastUpdate), number('2'), number('3'), string(/root/timezone), string(/root/contentLocale))))"/>')
  416. </xsl:if>
  417. <xsl:if test="$canSetThreshold">
  418. ,new thresholdsTooltipRenderer('_THIS_threshTooltip','<xts:string id="IDS_ADM_THR_SCORE_CALC" encode="javascript"/>','<xsl:value-of select="$resourceID"/>','<xsl:value-of select="xtsext:javascriptencode($name)"/>', '<xsl:value-of select="xtsext:javascriptencode($value)"/>','<xsl:value-of select="xtsext:javascriptencode($currentProperty/nemo:Type)"/>',<xsl:value-of select="$health != 'NotApplicable'"/>)
  419. </xsl:if>
  420. ]
  421. });
  422. </script>
  423. <uic:column scope="row">
  424. <uic:tooltipText id="{concat($rowID,'_caption')}" onmouseover="g__THIS_{$rowID}_caption.show(event);" onmouseout="g__THIS_{$rowID}_caption.hide(event);" onmousemove="g__THIS_{$rowID}_caption.mousemove(event);">
  425. <xsl:value-of select="$caption"/>
  426. </uic:tooltipText>
  427. <xsl:if test="$canSetThreshold">
  428. <uic:icon valign="middle" aria-labelledBy="{concat('_THIS_',$groupNum,'_groupcaption',' ', $rowID,'_caption',' ',$rowID,'_icon')}" id="{concat($rowID,'_icon')}">
  429. <uic:src>
  430. <admui:imageURL image="action_edit.gif" type="common"/>
  431. </uic:src>
  432. <uic:tooltip>
  433. <xts:string id="IDS_ADM_THR_EDIT_DIALOG_TIP"/>
  434. </uic:tooltip>
  435. <xsl:variable name="urlEncodedGrpCaption" select="xtsext:urlencode($grpCaption)"/>
  436. <xsl:variable name="urlEncodedCaption" select="xtsext:urlencode($caption)"/>
  437. <uic:onclick>_THIS_openDialog('<xsl:value-of select="xtsext:javascriptencode(string($urlEncodedGrpCaption))"/>', '<xsl:value-of select="xtsext:javascriptencode($urlEncodedCaption)"/>', '<xsl:value-of select="xtsext:javascriptencode($name)"/>','<xsl:value-of select="xtsext:javascriptencode($currentProperty/nemo:Type)"/>');</uic:onclick>
  438. </uic:icon>
  439. </xsl:if>
  440. </uic:column>
  441. <uic:column id="{concat($rowID,'_health')}" align="left" style="padding:0px" scope="row">
  442. <xsl:call-template name="ui:Health">
  443. <xsl:with-param name="health" select="$health"/>
  444. <xsl:with-param name="canSetThreshold" select="$canSetThreshold"/>
  445. </xsl:call-template>
  446. </uic:column>
  447. <uic:column id="{concat($rowID,'_value')}" nowrap="nowrap" onmouseover="g__THIS_{$rowID}_value.show(event);" onmouseout="g__THIS_{$rowID}_value.hide(event);" onmousemove="g__THIS_{$rowID}_value.mousemove(event);">
  448. <uic:text>
  449. <xsl:value-of select="$displayValue"/>
  450. </uic:text>
  451. </uic:column>
  452. </uic:row>
  453. </xsl:if>
  454. </xsl:template>
  455. <xsl:template name="healthSummary">
  456. <xsl:param name="poorCount" select="0"/>
  457. <xsl:param name="averageCount" select="0"/>
  458. <xsl:param name="goodCount" select="0"/>
  459. <xsl:param name="groupPosition" select="''"/>
  460. <xsl:param name="metricsFilter" select="''"/>
  461. <xsl:param name="filter" select="false()"/>
  462. <table cellpadding="0" border="0" cellspacing="0" role="presentation">
  463. <xsl:attribute name="name">healthSummary<xsl:value-of select="$groupPosition"/></xsl:attribute>
  464. <xsl:attribute name="id">healthSummary<xsl:value-of select="$groupPosition"/></xsl:attribute>
  465. <tr>
  466. <xsl:if test="boolean($filter) or not($metricsFilter= 'None')">
  467. <xsl:if test="boolean($filter) or contains($metricsFilter,'Poor')">
  468. <xsl:call-template name="HealthSummaryItem">
  469. <xsl:with-param name="health" select="'Poor'"/>
  470. <xsl:with-param name="counter" select="$poorCount"/>
  471. <xsl:with-param name="filter" select="$filter"/>
  472. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  473. <xsl:with-param name="filterLabel"><xts:string id="IDS_ADM_MET_FILTER_POOR_LABEL"/></xsl:with-param>
  474. </xsl:call-template>
  475. </xsl:if>
  476. <xsl:if test="boolean($filter) or contains($metricsFilter,'Average')">
  477. <xsl:call-template name="HealthSummaryItem">
  478. <xsl:with-param name="health" select="'Average'"/>
  479. <xsl:with-param name="counter" select="$averageCount"/>
  480. <xsl:with-param name="filter" select="$filter"/>
  481. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  482. <xsl:with-param name="filterLabel"><xts:string id="IDS_ADM_MET_FILTER_AVERAGE_LABEL"/></xsl:with-param>
  483. </xsl:call-template>
  484. </xsl:if>
  485. <xsl:if test="boolean($filter) or contains($metricsFilter,'Good')">
  486. <xsl:call-template name="HealthSummaryItem">
  487. <xsl:with-param name="health" select="'Good'"/>
  488. <xsl:with-param name="counter" select="$goodCount"/>
  489. <xsl:with-param name="filter" select="$filter"/>
  490. <xsl:with-param name="metricsFilter" select="$metricsFilter"/>
  491. <xsl:with-param name="filterLabel"><xts:string id="IDS_ADM_MET_FILTER_GOOD_LABEL"/></xsl:with-param>
  492. </xsl:call-template>
  493. </xsl:if>
  494. <xsl:if test="boolean($filter)">
  495. <td nowrap="nowrap">
  496. <input id="_THIS_filterNotApplicable" type="checkbox" onclick="_THIS_setFilter('NotApplicable::', this.checked);">
  497. <xsl:if test="contains($metricsFilter,'NotApplicable')">
  498. <xsl:attribute name="checked"/>
  499. </xsl:if>
  500. <xsl:attribute name="title"><xts:string id="IDS_ADM_MET_FILTER_OTHER"/></xsl:attribute>
  501. </input>
  502. </td>
  503. <td><label for="_THIS_filterNotApplicable"><xts:string id="IDS_ADM_MET_FILTER_OTHER"/></label></td>
  504. </xsl:if>
  505. </xsl:if>
  506. </tr>
  507. </table>
  508. </xsl:template>
  509. <xsl:template name="HealthSummaryItem">
  510. <xsl:param name="health" select="''"/>
  511. <xsl:param name="counter" select="0"/>
  512. <xsl:param name="filter" select="''"/>
  513. <xsl:param name="metricsFilter" select="''"/>
  514. <xsl:param name="filterLabel" select="''"/>
  515. <xsl:if test="boolean($filter)">
  516. <td nowrap="nowrap">
  517. <input id="{concat('_THIS_filter',$health)}" name="{concat('_THIS_filter',$health)}" aria-label="{$filterLabel}" title="{$filterLabel}" type="checkbox" onclick="{concat('_THIS_setFilter(&quot;',$health,':&quot;,this.checked);')}">
  518. <xsl:if test="contains($metricsFilter,$health)">
  519. <xsl:attribute name="checked"/>
  520. </xsl:if>
  521. </input>
  522. </td>
  523. </xsl:if>
  524. <td nowrap="nowrap">
  525. <xsl:call-template name="ui:Health">
  526. <xsl:with-param name="health" select="$health"/>
  527. <xsl:with-param name="disabled" select="$counter = 0"/>
  528. </xsl:call-template>
  529. </td>
  530. <td nowrap="nowrap" style="padding-right:10px">
  531. <uic:text>
  532. <xsl:value-of select="$counter"/>
  533. </uic:text>
  534. </td>
  535. </xsl:template>
  536. <xsl:template name="updateMetricValue">
  537. <xsl:param name="value" select="''"/>
  538. <xsl:param name="rowID" select="''"/>
  539. <xsl:param name="name" select="''"/>
  540. <xsl:variable name="lastResetAt" select="key('properties', $name)/@ResetAt"/>
  541. <xsl:variable name="lastUpdate" select="key('properties', $name)/@LastUpdated"/>
  542. <xsl:variable name="health" select="key('properties', $name)/@Health"/>
  543. <xsl:variable name="currentProperty" select="key('property-metadata', string($name))"/>
  544. <xsl:variable name="canSetThreshold" select="$currentProperty/nemo:CanSetThreshold = 'true'"/>
  545. <!-- does the value need to be formated -->
  546. <xsl:variable name="displayValue">
  547. <xsl:choose>
  548. <!-- date/time -->
  549. <xsl:when test="$value != '' and $currentProperty/nemo:Type = 'xs:dateTime'">
  550. <xsl:value-of select="xtsext:formatDateFromUTC(string($value), number('2'), number('3'), string(/root/timezone), string(/root/contentLocale))"/>
  551. </xsl:when>
  552. <!-- unsignedLong -->
  553. <xsl:when test="$value != '' and $currentProperty/nemo:Type = 'xs:unsignedLong'">
  554. <xsl:value-of select="xtsext:formatNumber(string($value), string(/root/contentLocale), number('2'))"/>
  555. </xsl:when>
  556. <!-- percentage -->
  557. <xsl:when test="$value != '' and $currentProperty/nemo:Type = 'cdm:percentage'">
  558. <xsl:value-of select="cogadminext:formatPercentage(string($value), string(/root/contentLocale))"/>
  559. </xsl:when>
  560. <!-- duration -->
  561. <xsl:when test="$value != '' and $currentProperty/nemo:Type = 'xs:duration'">
  562. <xsl:value-of select="xtsext:formatDuration($value,string(/root/contentLocale),number('2'))"/>
  563. </xsl:when>
  564. <!-- Pair of values to be formatted as a ratio (x/y) -->
  565. <xsl:when test="$value != '' and $currentProperty/nemo:Type = 'xs:numericRatio'">
  566. <xsl:value-of select="xtsext:formatNumber(substring-before($value,' '),string(/root/contentLocale),number('1'))"/>
  567. <xsl:value-of select="string('/')"/>
  568. <xsl:value-of select="xtsext:formatNumber(substring-after($value,' '),string(/root/contentLocale),number('1'))"/>
  569. </xsl:when>
  570. <!-- enum -->
  571. <xsl:when test="$value != '' and $currentProperty/nemo:Enumeration">
  572. <xsl:choose>
  573. <xsl:when test="$currentProperty/nemo:Enumeration/nemo:Enum[@value = string($value)]">
  574. <xsl:value-of select="$currentProperty/nemo:Enumeration/nemo:Enum[@value = string($value)]/nemo:Caption"/>
  575. </xsl:when>
  576. <xsl:otherwise>
  577. <xsl:value-of select="$value"/>
  578. </xsl:otherwise>
  579. </xsl:choose>
  580. </xsl:when>
  581. <xsl:when test="$value != '' and $currentProperty/nemo:Type = 'xs:list'">
  582. <xsl:choose>
  583. <xsl:when test="count($value/value) &gt; 1">
  584. <xts:string id="IDS_ADM_MET_VALUE_ABBR">
  585. <xts:param name="value">
  586. <xsl:value-of select="$value/value"/>
  587. </xts:param>
  588. </xts:string>
  589. </xsl:when>
  590. <xsl:otherwise>
  591. <xsl:value-of select="$value/value"/>
  592. </xsl:otherwise>
  593. </xsl:choose>
  594. </xsl:when>
  595. <xsl:otherwise>
  596. <xsl:value-of select="$value"/>
  597. </xsl:otherwise>
  598. </xsl:choose>
  599. </xsl:variable>
  600. <xsl:value-of select="$displayValue"/>
  601. </xsl:template>
  602. <xsl:template name="updateToolTip">
  603. <xsl:param name="rowID" select="''"/>
  604. <xsl:param name="lastResetAt" select="''"/>
  605. <xsl:param name="lastUpdate" select="''"/>
  606. <xsl:param name="name" select="''"/>
  607. <xsl:variable name="health" select="key('properties', $name)/@Health"/>
  608. var renderers = g__THIS_<xsl:value-of select="$rowID"/>_value.updateableRenderers;
  609. if (renderers) {
  610. var lrtRenderer = renderers['<xts:string id="IDS_ADM_TOO_LAST_RESET_TIME" encode="javascript"/>'];
  611. if (lrtRenderer) {
  612. lrtRenderer.update('<xsl:value-of select="xtsext:javascriptencode(string(xtsext:formatDateFromUTC(string($lastResetAt), number('2'), number('3'), string(/root/timezone), string(/root/contentLocale))))"/>');
  613. }
  614. var lutRenderer = renderers['<xts:string id="IDS_ADM_TOO_LAST_UPDATE_TIME" encode="javascript"/>'];
  615. if (lutRenderer) {
  616. lutRenderer.update('<xsl:value-of select="xtsext:javascriptencode(string(xtsext:formatDateFromUTC(string($lastUpdate), number('2'), number('3'), string(/root/timezone), string(/root/contentLocale))))"/>');
  617. }
  618. var threshRenderer = renderers['<xts:string id="IDS_ADM_THR_SCORE_CALC" encode="javascript"/>'];
  619. if (threshRenderer) {
  620. threshRenderer.update(<xsl:value-of select="$health != 'NotApplicable'"/>);
  621. }
  622. }
  623. </xsl:template>
  624. <xsl:template name="updateHealth">
  625. <xsl:param name="rowID" select="''"/>
  626. <xsl:param name="name" select="''"/>
  627. <xsl:param name="canSetThreshold" select="''"/>
  628. <xsl:variable name="health" select="key('properties', $name)/@Health"/>
  629. <xsl:variable name="healthWidget">
  630. <xsl:call-template name="ui:Health"><xsl:with-param name="health" select="$health"/><xsl:with-param name="canSetThreshold" select="$canSetThreshold"/></xsl:call-template>
  631. </xsl:variable>
  632. <xsl:copy-of select="$healthWidget"/>
  633. </xsl:template>
  634. </xsl:stylesheet>